Now the only thing holding me back is the actual constrained delaunay bit: If the delaunay triangulation does not contain all of the segments that make up the polygon, it craps out.
I guess I'll have to attempt a remedy for this by myself.
One possibly simple to implement method that I just thought of is:
(pseudocode)
The problem with that is, if I made a polygon that had 10 really long edges, it may need to divide up all the long segments so this algorithm would run the triangulation algorithm up to 10 times. Good for me not having to do work and re-code some nasty complicated stuff, but not good for speed!
Maybe I could do some statistical analysis on the segment lengths, and repeatedly split segments until maximum length is within some range of the median/mean...
Other than doing that I'd need to resort to some kind of segment insertion algorithm (for a polygon edge not in triangulation, create edge by cutting up triangles in the way) on the complete delaunay triangulation which I don't have any idea how to do.
edit: Doesnt seem like shortening segments will even necessarily make it work. nooooo!
I guess I'll have to attempt a remedy for this by myself.
One possibly simple to implement method that I just thought of is:
(pseudocode)
Code: Select all
while (numTriangles == 0)
{
find longest segment in polygon, split it in two (# polygon segments increases by 1)
run triangulator
set numTriangles to returned valid triangles // if a segment is not in triangulation it gives zero for numTriangles
}
The problem with that is, if I made a polygon that had 10 really long edges, it may need to divide up all the long segments so this algorithm would run the triangulation algorithm up to 10 times. Good for me not having to do work and re-code some nasty complicated stuff, but not good for speed!
Maybe I could do some statistical analysis on the segment lengths, and repeatedly split segments until maximum length is within some range of the median/mean...
Other than doing that I'd need to resort to some kind of segment insertion algorithm (for a polygon edge not in triangulation, create edge by cutting up triangles in the way) on the complete delaunay triangulation which I don't have any idea how to do.
edit: Doesnt seem like shortening segments will even necessarily make it work. nooooo!

