This project is read-only.

triangulate a polygon with code

May 12, 2015 at 6:34 AM
Edited May 12, 2015 at 6:36 AM
Hi,
How can i triangulate a simple polygon (simple polygon: polygon with no holes and cutting edges) with triangle.net and C# (I need the code). I was not able to find document about this...
Also the dimension and quality of triangles is not important.
Thank you.
May 12, 2015 at 9:59 AM
Edited May 12, 2015 at 10:04 AM
If you want to do FE analysis, you should really care about mesh quality :-)

This should get you started:
EDIT: assuming you are using the latest code (beta 4, in the source code section, not yet published)
using TriangleNet;
using TriangleNet.Geometry;
using TriangleNet.Meshing;

public class Test
{
    public Mesh Triangulate(IPolygon polygon)
    {
        return (Mesh)polygon.Triangulate();

        // Apply minimum angle constraint:
        // return (Mesh)polygon.Triangulate(new QualityOptions() { MinimumAngle = 25 });
    }
}
EDIT 2:
Also the dimension and quality of triangles is not important.
Triangle.NET is 2D only, so there's only one dimension to "choose"
Marked as answer by epsi1on on 5/12/2015 at 2:01 AM