This algorithm turns an arbitrary simple polygon into a series of triangles through the ear-clipping algorithm, and then re-combines the triangles into convex polygons. This convex decomposition is not an optimal one, but usually generates slightly fewer polygons than the triangulation produces.
- Click a series of points to draw polygon vertices in counter-clockwise order - this algorithm will fail if the points are ordered clockwise (will fix this soon).
- Press 'r' to clear points.
- If the polygon self-intersects, triangulation may fail, but it won't always.
Source code: EarClipping Polygon Triangle Triangulation
Built with Processing