Package arc.math

Class EarClippingTriangulator

java.lang.Object
arc.math.EarClippingTriangulator

public class EarClippingTriangulator extends Object
A simple implementation of the ear cutting algorithm to triangulate simple polygons without holes. For more information: If the input polygon is not simple (self-intersects), there will be output but it is of unspecified quality (garbage in, garbage out).
  • Constructor Details

    • EarClippingTriangulator

      public EarClippingTriangulator()
  • Method Details

    • computeTriangles

      public ShortSeq computeTriangles(FloatSeq vertices)
      See Also:
    • computeTriangles

      public ShortSeq computeTriangles(float[] vertices)
      See Also:
    • computeTriangles

      public ShortSeq computeTriangles(float[] vertices, int offset, int count)
      Triangulates the given (convex or concave) simple polygon to a list of triangle vertices.
      Parameters:
      vertices - pairs describing vertices of the polygon, in either clockwise or counterclockwise order.
      Returns:
      triples of triangle indices in clockwise order. Note the returned array is reused for later calls to the same method.