davidmarothi / VectorLinesDemo

Sample application, showcasing how to draw vector lines in MonoGame.
1 stars 0 forks source link

Missing documentation on clipping/triangulation of polygons #1

Open RudeySH opened 8 years ago

RudeySH commented 8 years ago

After viewing the source I'm interested in how the triangulation of polygons is implemented.

I noticed polygons are clipped before they are triangulated, using separate libraries. It seems the triangulation library (Triangle.NET) is unable to process complex polygons, but without documentation (or just comments) I'm not sure.

After doing some research on Triangle.NET it seems that library implements Delauney triangulation, which results into better shaped triangles, but that shouldn't be required for simply rendering polygons in a game context. Don't the constraints that a Delauney implementation has make the triangulation less performant?

bruhaha1989 commented 8 years ago

You are right. I encountered some edge-cases where triangualtion was not possible by the library. The pre-clipping seems to be a good workaround. I'm not expert in this topic, I'm only using the tools are provided by other talented developers. On the Delauney question. By doing Delauney triangulation, we can, hopefully, get less triangles, so we put more energy into generating nicer/less triangles, so later on the vertex buffer will hold less data, hence better performance during runtime later on. At least this was my idea :)