Facemorph
Class TessGen
java.lang.Object
Facemorph.TessGen
public class TessGen
- extends java.lang.Object
A fuction to calculate the Delaunay triangulation of the n points
points[ 0 ], ..., points[ n - 1 ]
It takes 6 arguments:
n the number of points
points an array, each element of which is a Point2D.Float.
top, bottom the bounding rectangle
left & right of the points.
and returns a pointer to an array, delaunayTriangulation, each element of
which is a delaunayTriangle.
The first element of the array triangles, i.e. triangles[0], is all null.
This represents the part of the plane not in the triangulation.
The end of the array of triangles is marked by a triangle adjacent to
the triangle -1 on all sides.
A delaunayTriangle consists of two arrays, t and v, each of 3 integers.
These are the indices of the three triangles adjacent to, and the three
vertices of the current triangle, in the arrays delaunayTriangulation
and points, respectively.
For example the fourth triangle has corners:
points[ triangles[ 4 ].v[ 0 ] ],
points[ triangles[ 4 ].v[ 1 ] ] and
points[ triangles[ 4 ].v[ 2 ] ],
clockwise around it (Which way are your axes?), and the triangle on the
other side of the edge between the first two of these points is
triangles[ triangles[ 4 ].t[ 0 ] ].
The algorithm is based on those of
Sloan, S.W. (1987). A Fast Algorithm for Constructing Delaunay
Triangulations in the Plane. Advances in Engineering Software, 9(1).
Correc, Y. & Chapuis, E. (1987). Fast Computation of Delaunay
Triangulations. Advances in Engineering Software 9(2).
Field Summary |
static int |
NULL
|
Constructor Summary |
TessGen()
Creates a new instance of TessGen |
Method Summary |
DelaunayTriangle[] |
delaunay(java.awt.geom.Point2D.Float[] points,
int n,
float left,
float right,
float top,
float bottom)
Delaunay triangulation method |
void |
initialise(int n)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NULL
public static final int NULL
- See Also:
- Constant Field Values
TessGen
public TessGen()
- Creates a new instance of TessGen
initialise
public void initialise(int n)
- Parameters:
n
-
delaunay
public DelaunayTriangle[] delaunay(java.awt.geom.Point2D.Float[] points,
int n,
float left,
float right,
float top,
float bottom)
- Delaunay triangulation method
- Parameters:
points
- the list of points to triangulaten
- the number of points to triangulateleft
- the left most x valueright
- the right most x valuetop
- the top most y valuebottom
- the bottom most y value
- Returns:
- returns the list of (Delaunay) triangles