Class Triangle
java.lang.Object
|
+----Polygon
|
+----Triangle
- public class Triangle
- extends Polygon
A class defining a triangle
-
Triangle(Vertex, Vertex, Vertex)
- Construct a triangle given three vertices.
-
edgeNeighbour(Vector, Vertex, Vertex)
- Returns the triangle that shares a particular edge.
-
matches(Vector)
- Tests whether a triangle is present in a vector.
-
matchIndex(Vector)
- Returns the index of a triangle in a vector.
-
sameTriangle(Triangle, Triangle)
- Tests whether two triangles are the same.
-
thirdVertex(Vertex, Vertex)
- Returns the third vertex of a triangle given the other two.
-
volume6(Vertex)
- Returns six times the volume of the tetrahedron formed by a
triangle and vertex.
-
volumeSign(Vertex)
- Returns the sign of the volume of the tetrahedron formed by a
triangle and a vertex.
Triangle
public Triangle(Vertex v1,
Vertex v2,
Vertex v3)
- Construct a triangle given three vertices.
- Parameters:
- v1, - v2, v3 the vertices
sameTriangle
public static boolean sameTriangle(Triangle t1,
Triangle t2)
- Tests whether two triangles are the same. Order of vertices is ignored.
- Parameters:
- t1, - t2 The triangles to compare
matches
public boolean matches(Vector vec)
- Tests whether a triangle is present in a vector.
- Parameters:
- vec - vector of triangles to match
matchIndex
public int matchIndex(Vector vec)
- Returns the index of a triangle in a vector.
- Parameters:
- vec - vector of triangles to match
- Returns:
- index of the match or -1 if no match
thirdVertex
public Vertex thirdVertex(Vertex v1,
Vertex v2)
- Returns the third vertex of a triangle given the other two.
- Parameters:
- v1, - v2 the other two vertices
- Returns:
- the third vertex or null if v1 and v2 are not
vertices
edgeNeighbour
public Triangle edgeNeighbour(Vector tris,
Vertex v1,
Vertex v2)
- Returns the triangle that shares a particular edge.
- Parameters:
- s - tris the list of triangles to search
v1 v2 the vertices that define the edge
- Returns:
- the neighbouring triangle or null if not found
volumeSign
public int volumeSign(Vertex v)
- Returns the sign of the volume of the tetrahedron formed by a
triangle and a vertex. VolumeSign is positive iff the vertex is
on the negative side of the triangle, where the positive side is
determined by the rh-rule. So the volume is positive if the ccw
normal to points outside the tetrahedron. The final
fewer-multiplications form is due to Bob Williamson.
- Parameters:
- v - vertex to test
- Returns:
- -1/0/1 if vertex is on the negative/coplanar/positive
side of the triangle according to the rh-rule
volume6
public int volume6(Vertex v)
- Returns six times the volume of the tetrahedron formed by a
triangle and vertex. The volume is positive iff the vertex is on
the negative side of the triangle, where the positive side is
determined by the rh-rule.
- Parameters:
- v - the vertex