com.jmex.subdivision
Class SubdivisionButterfly.Triangle

java.lang.Object
  extended by com.jmex.subdivision.SubdivisionButterfly.Triangle
Enclosing class:
SubdivisionButterfly

public class SubdivisionButterfly.Triangle
extends java.lang.Object

Inner helper class for SubdivisonBatch to keep track of the triangles

Author:
Tobias
See Also:
SubdivisionButterfly.findEdgesAndTriangles()

Field Summary
 SubdivisionButterfly.Edge[] edges
          The three Edges of this Triangle
 int[] vertexIndex
          The three vertex indices of this Triangle
 
Constructor Summary
SubdivisionButterfly.Triangle()
          Constructor
SubdivisionButterfly.Triangle(int i1, int i2, int i3)
          Constructor
 
Method Summary
 SubdivisionButterfly.Edge findEdge(int vertexIndex1, int vertexIndex2)
          Find the Edge of this Triangle with the provided vertex indices
 SubdivisionButterfly.Edge findOtherSharedEdge(int vertexIndex, SubdivisionButterfly.Edge edge)
          Finds the other edge in this triangle which has the vertex i.e.
 int findThirdVertex(int vertexIndex1, int vertexIndex2)
          Given two vertex indices of this Triangle, find the third vertex index
 int findThirdVertex(SubdivisionButterfly.Edge edge)
          Given two vertex indices of this Triangle, find the third vertex index
 boolean hasEdge(SubdivisionButterfly.Edge edge)
          Does this Triangle contain the given Edge?
 boolean isCCW(SubdivisionButterfly.Edge edge, int vertexIndex)
          Returns true if the triangle is counter-clockwise from the edges point of view, looking down the edge starting at vertex vertexIndex
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

vertexIndex

public int[] vertexIndex
The three vertex indices of this Triangle


edges

public SubdivisionButterfly.Edge[] edges
The three Edges of this Triangle

Constructor Detail

SubdivisionButterfly.Triangle

public SubdivisionButterfly.Triangle()
Constructor


SubdivisionButterfly.Triangle

public SubdivisionButterfly.Triangle(int i1,
                                     int i2,
                                     int i3)
Constructor

Parameters:
i1 -
i2 -
i3 - The three vertex indices of this Triangle
Method Detail

hasEdge

public boolean hasEdge(SubdivisionButterfly.Edge edge)
Does this Triangle contain the given Edge?

Parameters:
edge - The edge to look for
Returns:
true if the edge is found

isCCW

public boolean isCCW(SubdivisionButterfly.Edge edge,
                     int vertexIndex)
Returns true if the triangle is counter-clockwise from the edges point of view, looking down the edge starting at vertex vertexIndex

Parameters:
edge -
vertexIndex -
Returns:
Whether the triangle is counter-clockwise from the edges point of view

findEdge

public SubdivisionButterfly.Edge findEdge(int vertexIndex1,
                                          int vertexIndex2)
Find the Edge of this Triangle with the provided vertex indices

Parameters:
vertexIndex1 -
vertexIndex2 -
Returns:
The found Edge, or null if none was found in this Triangle

findThirdVertex

public int findThirdVertex(SubdivisionButterfly.Edge edge)
Given two vertex indices of this Triangle, find the third vertex index

Parameters:
edge - The edge that defines the other two vertex indices
Returns:
The third vertex index

findThirdVertex

public int findThirdVertex(int vertexIndex1,
                           int vertexIndex2)
Given two vertex indices of this Triangle, find the third vertex index

Parameters:
vertexIndex1 -
vertexIndex2 -
Returns:
The third vertex index

findOtherSharedEdge

public SubdivisionButterfly.Edge findOtherSharedEdge(int vertexIndex,
                                                     SubdivisionButterfly.Edge edge)
Finds the other edge in this triangle which has the vertex i.e. if edge=a,b and vertex=a then otherEdge=a,c is returned

Parameters:
vertexIndex - The vertex index who's other Edge we want to find
edge - The edge we already know of
Returns:
The other edge, or null if vertex index or Edge provided are not in the triangle

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
A String representing this Triangle