Package limn.graphics
Class PolygonTriangulator
java.lang.Object
limn.graphics.PolygonTriangulator
Ear-clipping triangulation of simple (non-self-intersecting) polygons,
convex or concave, any winding. Support code for backends (and tested
headlessly here); not meant as application API.
-
Method Summary
Modifier and TypeMethodDescriptionstatic floatsignedArea(float[] xs, float[] ys, int offset, int count) Signed polygon area (positive = clockwise with y growing down).static int[]triangulate(float[] xs, float[] ys, int offset, int count) Triangulates the polygon(xs[offset + i], ys[offset + i])fori < count.
-
Method Details
-
triangulate
public static int[] triangulate(float[] xs, float[] ys, int offset, int count) Triangulates the polygon(xs[offset + i], ys[offset + i])fori < count.- Returns:
- triangle vertex indices relative to
offset,3 * (count - 2)entries on success; degenerate inputs (collinear rings, count < 3) may produce fewer triangles
-
signedArea
public static float signedArea(float[] xs, float[] ys, int offset, int count) Signed polygon area (positive = clockwise with y growing down).
-