I am trying to create the polygons for a Doom 2 level from the information contained in the WAD file. I have the walls done, all that is left is the 'flats', the floor and ceiling areas. A Doom map is divided into 'sectors', each evaluates to a flat, complex polygon.
It would be easy enough to decompose a simple, convex polygon into triangles, as there are many algorithms for this. But many of the sector polys are concave, and some even have 'holes' where other sectors are within them. Here is an example, with a particularly complex poly shown in orange: http://screencast.com/t/BNKuzRVy8
Can anyone recommend an algorithm, or better yet C# code, that will decompose this kind of complex poly into triangles?
I know that the WAD file includes NODE, SEG, SUBSECTOR information, etc. that indirectly describes a breakdown in this fashion. But it is particularly complex. I don't need the b-tree structure. I would like to avoid having to parse all of this information out and piece it together, since I have the complex poly structure from the sector info alone.
Look for Ear Clipping triangulation method, a good start point is this David Elbery article.