Class Triangulator

java.lang.Object
org.oscim.utils.Triangulator

public class Triangulator extends Object
Triangulates a polygon into triangles - duh. Doesn't handle holes in polys
  • 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 point
      y - 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 interegate
      i - The index of the point within the triangle to retrieve (0 - 2)
      Returns:
      The x,y coordinate pair for the point