-
-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Intersection may have badly ordered points. #99
Comments
Resolved in 0.6.0 by #111 Now produces
|
Not resolved by #111 , turns out the demo site had some issues :( Needs further investigation |
I had a look into that and figured out what is happening. It is indeed a floating point stability problem. When exaggerating the coordinates a little bit, the example is structurally equivalent to this: Note that the last edge of the smaller polygon is perfectly straight, but goes from a slightly smaller x on the top (
The problem here is the x value of This particular example has a simple work-around: We could add a check after the intersection computation that ensures that intersection points don't fall out of the possible range. In the example, the valid x-values of an intersection points are Note: This test case is the first example that goes into this branch, which feels a bit like a hack to account for out-of-order intersection points, and currently doesn't seem to be covered by tests. It feels like we could get rid of it if the intersection points would never be out-of-order. What would be an interesting test case: Similar scenario, but |
Good research @bluenote10 - I wonder if we could apply add an epsilon to the comparison and whether that would be enough to catch the edge cases... |
@w8r / @rowanwins For the Rust version I'd propose this solution now: 21re/rust-geo-booleanop#11. |
This is now resolved in 0.7.3 |
Will produce:
This seems to be a rounding-ish issue (ordering is correct when using 631 instead of 531)
The text was updated successfully, but these errors were encountered: