Original Post
So I'm nearing a point with my engine that I have to start thinking about generalized polygon triangulation. This involves input from the designers, so I have no preset rules on what the polygon looks like. I've been doing my homework (and am still doing it), and I can see this is no trivial subject! As far as I can tell, triangulating a polygon with n verts is trivial as long as A) there are no holes B) it's planar, and C) it doesn't self-intersect. If these hold true, triangulating a polygon (either convex or concave) is pretty simple stuff. Unfortunately, if I want a robust tesselator, I also have to deal with those three cases. A) For the holes issue, there seems to be a fair bit of literature out there on dealing with them in a pretty robust manner. I'm not so worried about holes. I'll probably regret saying that later, but at least right now it seems like I can handle holes. B) Dealing with non-planar polygons. I've not managed to dig up *anything* on dealing with this issue. If you ignore it, you could really badly distort the original shape (which is certainly not the desired result). It seems to me that you could run the polygon through some sort of "preprocessor" and break it up along major "folds" in the polygon such that the subpolys are all now planar (within a certain tolerance) before you move into the tesselation stage. Is that how y'all would handle it? Any other suggestions? C) Dealing with self-intersecting polygons (i.e. the "Bowtie"). I've seen that some algorithms try to deal with self-intersections, but most just throw up their hands and say they aren't supported. Triangulating a self-intersecting polygon seems horrendously complicated. Forgive me if this seems overly naive, but wouldn't it be much easier to once again run the poly through a preprocessor and check for these self intersections (just a chord-chord intersection check)? If found you split the poly in two (drop a vertex at the intersection point. Do that recursively, and you can eliminate this issue altogether. Couldn't you? In summary, the way I'm considering dealing with these issues is: A) For each object in the scene B) For each face on the object C) Check for self-intersections, if found, split the face into two faces. Select one face for further checking, add the other to the "todo" list (from B on). Do this recursively until no self-intersections remain. D) Check for face planarity, within a certain tolerance. If not within tolerance, split the face in two along the best fold (how to do this???). Select one face for further checking, add the other to the "todo" list (from B on). Do this recursively until face is planer within the tolerance level. E) Triangulate the resulting face, with support for holes via the usual sorts of triangulation algorithms. NOTE: This doesn't need to happen in realtime by any means! Triangulation is happening in the design phase, by the time the objects get to the user, they will long since have been converted to triangles, heh. Any comments? Am I being completely naive on this whole approach? Thanks, Ron