Closed roystgnr closed 2 years ago
I could try pushing those new boundary points outward a little bit so that they end up in the working convex-by-eps case
This works for a single cycle of boundary refinement, but I hit the same error after many cycles. In hindsight it's hard to come up with a value of X in "perturb outward by X" that doesn't make it possible for the addition of a new node to create a slight concavity at its neighbors, even if it's always itself a slight convexity.
the failing concave-by-eps case
Interestingly, poly2tri is okay with clear concavity. If I bump eps up to 1e-12 or so (I guess that's enough to get us out of the COLLINEAR
detection?) we seem to be working fine.
It took a while for me to hit this in a real use case, but once I did it was surprisingly easy to boil down:
A stack trace shows us dying 3 levels of
p2t::Sweep::EdgeEvent
deep, lines 114,151,120. I'm afraid I don't really understand it, though. TheEPSILON
tolerance inOrient2D
puts us in theo2 == COLLINEAR
block, which should be true for all practical purposes and should be the same block we reach in theeps = 0
case, so why are we then failing for positiveeps
?Hope you can help find a fix for this. My user code that first tripped the error does adaptive refinement of boundary edges, which combined with FP roundoff means it's going to be generating not-quite-collinear points all the time. I could try pushing those new boundary points outward a little bit so that they end up in the working convex-by-eps case rather than the failing concave-by-eps case, but that doesn't sound like a robust workaround.