Package org.oscim.utils
Class Triangulator
- java.lang.Object
-
- org.oscim.utils.Triangulator
-
public class Triangulator extends java.lang.ObjectTriangulates a polygon into triangles - duh. Doesn't handle holes in polys
-
-
Constructor Summary
Constructors Constructor Description Triangulator()Create a new triangulator
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPolyPoint(float x, float y)Add a point describing the polygon to be triangulatedintgetTriangleCount()Get a count of the number of triangles producedfloat[]getTrianglePoint(int tri, int i)Get a point on a specified generated trianglebooleantriangulate()Cause the triangulator to split the polygon
-
-
-
Method Detail
-
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
-
-