A concise implementation of the 'ear clipping' (aka 'subtracting ears') algorithm to convert simple (convex or concave, no holes) polygons to a collection of triangles. These triangles can then easily be used in 3D mesh geometries. The implementation favors simplicity over performance.
The project is provided as a VS2008 solution and two C# classes.
The two classes are:
1) a simple Polygon class that calculates polygon area, determines vertex types and knows how to close a polygon.
2) a Triangulation2D class that takes a Polygon instance and returns a list of triangles that covers the polygon.
A simple Winform form is included to generate random polygons that test the algorithm, and to provide a sample of how to use the Triangulation2D class.
Sample source code is provided showing how to convert the resulting triangles to a WPF 3D MeshGeometry3D.