LibTessDotNet
Goal
Provide a robust and fast tessellator (polygons with N vertices in the output) for .NET, also does triangulation.
Requirements
- .NET Standard 2.0 (see here for more information)
Features
- Tessellate arbitrary complex polygons
- self-intersecting (see "star-intersect" sample)
- with coincident vertices (see "clipper" sample)
- advanced winding rules : even/odd, non zero, positive, negative, |winding| >= 2 (see "redbook-winding" sample)
- Custom input
- Custom vertex attributes (eg. UV coordinates) with merging callback
- Force orientation of input contour (clockwise/counterclockwise, eg. for GIS systems, see "force-winding" sample)
- Choice of output
- polygons with N vertices (with N >= 3)
- connected polygons (didn't quite tried this yet, but should work)
- boundary only (to have a basic union of two contours)
- Handles polygons computed with Clipper - an open source freeware polygon clipping library
- Single/Double precision support
Screenshot
Comparison
Build
Example
From TessExample/Program.cs
Notes
- When using
ElementType.BoundaryContours, Tess.Elements will contain a list of ranges [startVertexIndex, vertexCount].
Those ranges are to used with Tess.Vertices.
TODO
- No allocations with the same input twice, all coming from pool
- Any suggestions are welcome ;)
License
SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
More information in LICENSE.txt.
Links
- Reference implementation - the original SGI reference implementation
- libtess2 - Mikko Mononen cleaned up the original GLU tesselator
- Poly2Tri - another triangulation library for .NET (other ports also available)
- Does not support polygons from Clipper, more specifically vertices with same coordinates (coincident)
- Clipper - an open source freeware polygon clipping library