This project has moved and is read-only. For the latest updates, please go here.
1
Vote

missing triangle

description

I noticed there would be an occasional triangle missing and would also really mess up holes.
In the Triangulate function I noticed that there was sometimes 4 vertices left to create triangle, I modified the code to below (search for the beginning comment) and it fixed all the issues I was having... at least for now.
 
        //if there are still three points, use that for the last triangle
        if (polygonVertices.Count > 2)
        {
            triangles.Add(new Triangle(
                polygonVertices[0].Value,
                polygonVertices[1].Value,
                polygonVertices[2].Value));

            if (polygonVertices.Count > 3)
            {
                triangles.Add(new Triangle(
                    polygonVertices[0].Value,
                    polygonVertices[2].Value,
                    polygonVertices[3].Value));                                 
            }
        }

comments

DavidTully wrote May 14, 2014 at 3:59 PM

Thanks for the fix, works great.