com.badlogic.gdx.math
Class DelaunayTriangulator
java.lang.Object
com.badlogic.gdx.math.DelaunayTriangulator
public class DelaunayTriangulator
- extends Object
Delaunay triangulation. Adapted from Paul Bourke's triangulate: http://paulbourke.net/papers/triangulate/
- Author:
- Nathan Sweet
Method Summary |
ShortArray |
computeTriangles(float[] polygon,
boolean sorted)
|
ShortArray |
computeTriangles(float[] points,
int offset,
int count,
boolean sorted)
Triangulates the given point cloud to a list of triangle indices that make up the Delaunay triangulation. |
ShortArray |
computeTriangles(FloatArray points,
boolean sorted)
|
void |
trim(ShortArray triangles,
float[] points,
float[] hull,
int offset,
int count)
Removes all triangles with a centroid outside the specified hull, which may be concave. |
DelaunayTriangulator
public DelaunayTriangulator()
computeTriangles
public ShortArray computeTriangles(FloatArray points,
boolean sorted)
- See Also:
computeTriangles(float[], int, int, boolean)
computeTriangles
public ShortArray computeTriangles(float[] polygon,
boolean sorted)
- See Also:
computeTriangles(float[], int, int, boolean)
computeTriangles
public ShortArray computeTriangles(float[] points,
int offset,
int count,
boolean sorted)
- Triangulates the given point cloud to a list of triangle indices that make up the Delaunay triangulation.
- Parameters:
points
- x,y pairs describing points. Duplicate points will result in undefined behavior.sorted
- If false, the points will be sorted by the x coordinate, which is required by the triangulation algorithm. If
sorting is done the input array is not modified, the returned indices are for the input array, and count*2
additional working memory is needed.
- Returns:
- triples of indices into the points that describe the triangles in clockwise order. Note the returned array is reused
for later calls to the same method.
trim
public void trim(ShortArray triangles,
float[] points,
float[] hull,
int offset,
int count)
- Removes all triangles with a centroid outside the specified hull, which may be concave. Note some triangulations may have
triangles whose centroid is inside the hull but a portion is outside.
Copyright © 2013. All Rights Reserved.