|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object glmodel.GL_Triangle
public class GL_Triangle
Describes a triangular face. Holds references to three vertices, their normals and texture coodinates. Vertex normals are stored here and not in the Vertex object because a vertex may be shared between two or more faces, and the faces may have very different normals (ie. if the faces are at a 90 degree angle and make a sharp edge). To smooth normals and preserve sharp edges, the Triangle object holds the neighboring triangles for each vert. Based on the angles between this triangle and its neighbors, the smoothing algorithm can decide whether to smooth the normals across the triangles, or to use the face normal to create a hard edge. jun 2006: added makeClone()
Field Summary | |
---|---|
int |
groupID
|
int |
ID
|
GL_Vector |
n
|
java.util.ArrayList |
neighborsP1
|
java.util.ArrayList |
neighborsP2
|
java.util.ArrayList |
neighborsP3
|
GL_Vector |
norm1
|
GL_Vector |
norm2
|
GL_Vector |
norm3
|
GL_Vertex |
p1
|
GL_Vertex |
p2
|
GL_Vertex |
p3
|
GL_Vector |
uvw1
|
GL_Vector |
uvw2
|
GL_Vector |
uvw3
|
float |
Zdepth
|
Constructor Summary | |
---|---|
GL_Triangle(GL_Vertex a,
GL_Vertex b,
GL_Vertex c)
|
Method Summary | |
---|---|
void |
calcZdepth()
Calculate average screen Z depth of this triangle. |
GL_Vector |
getCenter()
|
GL_Vector |
getWeightedNormal()
|
GL_Triangle |
makeClone()
|
static boolean |
onSameSurface(GL_Triangle t1,
GL_Triangle t2,
float cos_angle)
Return true if two triangles should be smoothed as one surface. |
void |
recalcFaceNormal()
Calculate the face normal for this triangle |
GL_Vector |
recalcVertexNormal(java.util.ArrayList neighbors)
Recalculate the vertex normal, by averagin the normals of the neighboring triangles. |
void |
resetNeighbors()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public GL_Vertex p1
public GL_Vertex p2
public GL_Vertex p3
public GL_Vector norm1
public GL_Vector norm2
public GL_Vector norm3
public GL_Vector uvw1
public GL_Vector uvw2
public GL_Vector uvw3
public java.util.ArrayList neighborsP1
public java.util.ArrayList neighborsP2
public java.util.ArrayList neighborsP3
public GL_Vector n
public float Zdepth
public int ID
public int groupID
Constructor Detail |
---|
public GL_Triangle(GL_Vertex a, GL_Vertex b, GL_Vertex c)
Method Detail |
---|
public void recalcFaceNormal()
public GL_Vector recalcVertexNormal(java.util.ArrayList neighbors)
neighbors
- neighboring triangles for this vert
GL_Object.registerNeighbors()
public GL_Vector getWeightedNormal()
public GL_Vector getCenter()
public void resetNeighbors()
public void calcZdepth()
GL_Mesh.project()
public static boolean onSameSurface(GL_Triangle t1, GL_Triangle t2, float cos_angle)
public GL_Triangle makeClone()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |