|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.grogra.imp3d.VertexArray de.grogra.imp3d.PolygonArray
public class PolygonArray
This class represents a list of polygons.
Field Summary | |
---|---|
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. |
Fields inherited from class de.grogra.imp3d.VertexArray |
---|
dimension, userObject, vertices |
Constructor Summary | |
---|---|
PolygonArray()
|
Method Summary | |
---|---|
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. |
Methods inherited from class de.grogra.imp3d.VertexArray |
---|
addVertex, addVertex, addVertex, computeNormal, init, wasCleared |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public 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.
Constructor Detail |
---|
public PolygonArray()
Method Detail |
---|
public void computeNormals()
public void copyNormal(int from, int to)
from
- the source indexto
- the target indexpublic void freeArrays()
freeArrays
in class VertexArray
public int getMaxEdgeCount()
Mesh
getMaxEdgeCount
in interface Mesh
public 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)
Mesh
index
.
The normal vector is not necessarily normalized.
getNormal
in interface Mesh
index
- normal numberout
- normal vector will be placed in herepublic int getNormalCount()
Mesh
getNormalCount
in interface Mesh
public int getPolygon(int index, int[] indicesOut, int[] normalsOut)
Mesh
index
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 Mesh
index
- polygon numberindicesOut
- the vertex indices will be placed in herenormalsOut
- the normal indices will be placed in here
public int getPolygonCount()
Mesh
getPolygonCount
in interface Mesh
public void getUV(int index, Tuple2d out)
Mesh
index
.
getUV
in interface Mesh
index
- vertex numberout
- uv coordinates will be placed in herepublic void getVertex(int index, Tuple3d out)
Mesh
index
.
getVertex
in interface Mesh
index
- vertex numberout
- vertex coordinates will be placed in herepublic int getVertexCount()
Mesh
getVertexCount
in interface Mesh
public boolean isClosed()
Mesh
isClosed
in interface Mesh
public boolean isPolygonPlanar(int index)
Mesh
true
iff the polygon number
index
is planar.
isPolygonPlanar
in interface Mesh
index
- polygon number
public 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
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |