de.grogra.imp3d
public class PolygonArray extends VertexArray implements Mesh
| Modifier and Type | Field and Description |
|---|---|
boolean |
closed
Indicates whether this polygon is a closed surface or not.
|
int |
edgeCount
Defines the number of edges of the polygons in this list.
|
ByteList |
normals
This list contains the (unnormalized) normal vectors.
|
boolean |
planar
Flag indicating whether the polygons are
planar. |
IntList |
polygonNormals
Specifies the normal indices of polygons if
usePolygonNormals is true. |
IntList |
polygons
Specifies the polygons.
|
boolean |
usePolygonNormals
Indicates whether normal indices are specified separately
by
polygonNormals or just like the other indices
by polygons. |
FloatList |
uv
This list contains the uv coordinates.
|
int |
visibleSides
Enumeration value indicating the visible polygon sides.
|
dimension, userObject, vertices| Constructor and Description |
|---|
PolygonArray() |
| Modifier and Type | Method and Description |
|---|---|
void |
computeNormals()
Compute normal vector for every vertex.
|
void |
copyNormal(int from,
int to)
Copies a vector in the list of normal vectors.
|
void |
freeArrays() |
int |
getMaxEdgeCount()
Returns the maximum number of edges of a single polygon
of the mesh.
|
void |
getNormal(float[] out,
int index)
Reads the value of the normal vector at
index
and places it in out. |
void |
getNormal(int index,
Tuple3d out)
Gets the normal vector of normal
index. |
int |
getNormalCount()
Returns the number of normals of the mesh.
|
int |
getPolygon(int index,
int[] indicesOut,
int[] normalsOut)
Writes the vertex indices of polygon
index
to indicesOut and the normal indices to
normalsOut and returns the number of
vertices of the polygon. |
int |
getPolygonCount()
Returns the number of polygons of the mesh.
|
void |
getUV(int index,
Tuple2d out)
Gets the uv coordinates of vertex
index. |
void |
getVertex(int index,
Tuple3d out)
Gets the spatial vertex coordinates of vertex
index. |
int |
getVertexCount()
Returns the number of vertices of the mesh.
|
boolean |
isClosed()
Indicates whether this mesh is a closed surface or not.
|
boolean |
isPolygonPlanar(int index)
Returns
true iff the polygon number
index is planar. |
void |
setNormal(int index,
float x,
float y,
float z)
Sets a normal vector.
|
addVertex, addVertex, addVertex, computeNormal, init, wasClearedpublic boolean closed
public int edgeCount
edgeCount
may only be 3 (triangles) or 4 (quadrilaterals).public ByteList normals
byte-values
for each vertex. Each byte-value c is to be
interpreted as a floating-point vector component f
in the range [-1, 1] using the formula
public boolean planar
planar. In
the case of triangles, this is always the case. In the case of
quadrilaterals, it is guaranteed that each quadrilateral will be planar
(all vertices lie on a plane) if planar is true.public IntList polygonNormals
usePolygonNormals is true.
For each entry in polygons, i.e., a vertex,
a corresponding entry has to
be present which defines the index into normals.public IntList polygons
edgeCount indices
into the other arrays (however note that if
usePolygonNormals is true, normal indices
are specified by polygonNormals).
The polygons are placed one after
another without space inbetween.public boolean usePolygonNormals
polygonNormals or just like the other indices
by polygons.public FloatList uv
float-values
for each vertex.public int visibleSides
Attributes.VISIBLE_SIDES_FRONT, only front sides
(as defined by the counter-clockwise order of vertices) are visible.
If this is Attributes.VISIBLE_SIDES_BACK, only back sides
are visible. For Attributes.VISIBLE_SIDES_BOTH, both sides
are visible.public void computeNormals()
public void copyNormal(int from,
int to)
from - the source indexto - the target indexpublic void freeArrays()
freeArrays in class VertexArraypublic int getMaxEdgeCount()
MeshgetMaxEdgeCount in interface Meshpublic void getNormal(float[] out,
int index)
index
and places it in out.out - the result will be placed in hereindex - the index of the normal vector (note that the actual index
into normals is 3 * index)public void getNormal(int index,
Tuple3d out)
Meshindex.
The normal vector is not necessarily normalized.public int getNormalCount()
MeshgetNormalCount in interface Meshpublic int getPolygon(int index,
int[] indicesOut,
int[] normalsOut)
Meshindex
to indicesOut and the normal indices to
normalsOut and returns the number of
vertices of the polygon. If the mesh is closed
(see Mesh.isClosed()), inside and outside are determined by the
ordering of the vertices: when seen from the outside, vertices have
to be oriented in a counter-clockwise manner. Then also the normal
vectors have to point to the outside.getPolygon in interface Meshindex - polygon numberindicesOut - the vertex indices will be placed in herenormalsOut - the normal indices will be placed in herepublic int getPolygonCount()
MeshgetPolygonCount in interface Meshpublic void getUV(int index,
Tuple2d out)
Meshindex.public void getVertex(int index,
Tuple3d out)
Meshindex.public int getVertexCount()
MeshgetVertexCount in interface Meshpublic boolean isClosed()
Meshpublic boolean isPolygonPlanar(int index)
Meshtrue iff the polygon number
index is planar.isPolygonPlanar in interface Meshindex - polygon numberpublic void setNormal(int index,
float x,
float y,
float z)
index - the index of the normal vector (note that the actual index
into normals is 3 * index)x - the x-componenty - the y-componentz - the z-component