I've checked multiple related answers but none seem to capture the problem I face.
- I have to triangulate various polyhedra.
- Each polyhedral face is closed.
- Faces are usually convex but not exclusively.
- Faces can occasionally be self-intersecting but if so they probably have radial symmetry (for example a pentagram)
- Each face is mostly planar (I'm prepared to suffer the consequences if not as it's technically an error)
By observation it seems that adding a new vertex at the centroid and creating a new face by connecting each edge to this vertex always successfully triangulates the face. However - it has a performance cost and simple fan triangulation also succeeds in 95% of cases. However when it fails it fails badly.
Is there an efficient way to detect self-intersecting and/or concave faces so I can fall back to the slower path? Obviously the detection algorithm has to be pretty efficient if the cost of checking isn't to exceed the cost of just assuming the worst and using centroid triangulation in all cases.
I actually suspect my energies are better spent on optimising centroid triangulation rather than working on detecting if it's actually necessary but I was curious what the Stack Overflow community thought.