Closed mourner closed 6 years ago
Ha, so you've found the same fix in https://github.com/fogleman/delaunay/commit/b6dfa1814edb23c117d05d4e4362b1935e34058c :)
Yeah. I wasn't sure if my "fix" was a hack or not though, so I'm glad to see this.
Oh nice, I was wondering how best to validate the triangulation. Comparing the hull area to the sum of the triangle areas looks like a good approach!
@fogleman yeah, I've been using this approach for a few years in earcut and it works very well.
Regarding the fix — the issue is that recursive flipping can go deep enough to get to the other side of the hull, which is common in the circle case because all triangles are sliver and likely to need flipping in the same pass when adding a point on the side, but it can happen in other cases. The check simply stops the flipping if we reached the boundary.
Closes #13. Turns out on certain kinds of degenerate input (such as points on a circle), the algorithm tried to flip triangles on the boundary (which don't have a pair). cc @fogleman