Package org.oscim.utils
Class Triangulator
java.lang.Object
org.oscim.utils.Triangulator
Triangulates a polygon into triangles - duh. Doesn't handle
holes in polys
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPolyPoint(float x, float y) Add a point describing the polygon to be triangulatedintGet a count of the number of triangles producedfloat[]getTrianglePoint(int tri, int i) Get a point on a specified generated trianglebooleanCause the triangulator to split the polygon
-
Constructor Details
-
Triangulator
public Triangulator()Create a new triangulator
-
-
Method Details
-
addPolyPoint
public void addPolyPoint(float x, float y) Add a point describing the polygon to be triangulated- Parameters:
x- The x coordinate of the pointy- the y coordinate of the point
-
triangulate
public boolean triangulate()Cause the triangulator to split the polygon- Returns:
- True if we managed the task
-
getTriangleCount
public int getTriangleCount()Get a count of the number of triangles produced- Returns:
- The number of triangles produced
-
getTrianglePoint
public float[] getTrianglePoint(int tri, int i) Get a point on a specified generated triangle- Parameters:
tri- The index of the triangle to interegatei- The index of the point within the triangle to retrieve (0 - 2)- Returns:
- The x,y coordinate pair for the point
-