-
Notifications
You must be signed in to change notification settings - Fork 292
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
Polygon intersection fails with "Given edges do not form loops (indegree != outdegree)" #158
Comments
Just make a self-contained example and put it here or in a gist. 200 vertices is fine. |
I used |
Can you reproduce the bug if you use S2Polygon::Encode/Decode? If so, attach binary files of the encoded polygons. |
Hey Jesse, I tried using Encode/Decode but was unable to reproduce the bug. I also just noticed something surprising about the bug: I included a P1.intersects(P2) call right before the InitToIntersection call. The former succeeds while the latter doesn't. |
So you're saying if you call InitToIntersection, it fails, but if you Encode/Decode the polygons first, it works? Sounds like you might have some memory issues. Try running with msan/asan/ubsan. If that doesn't find it, there must be some way to make a self-contained test case. |
Do you have a test case for this? |
I was unable to generate a test case for this. Running with msan / asan / ubsan did not help either.. Currently this is a bit low-priority for me, so I am not planning to spend more time on this. Feel free to close this issue.. |
I encountered an error when intersecting two polygons, say
p1
andp2
. At a high level, I am starting with several polygons formed withMakeRegularLoop
like below and then applying several boolean operations between them (intersection, difference).The error message is:
FATAL INTERSECTION operation failed: Given edges do not form loops (indegree != outdegree)Aborted (core dumped)
coming froms2builder_graph.cc:301
.Couple of important points to note:
Both the polygons
p1
andp2
have only one loop. I also added a check to ensure that the polygons are valid.The error is occuring only when the polygons have many vertices. It happens when NUM_VERTICES = 200 above but doesn't if it is 150.
The error also occurs only when I set the boolean operaton option
PolygonModel::CLOSED
(which is required for my usecase).I have been trying to think of what's the best way to encode the two polygons so that someone else can reproduce the error. I can provide the list of vertices, but as the error is occuring only when the polygons have many vertices, I thought it might not be ideal. Any ideas on how to encode the polygon in a better way?
The text was updated successfully, but these errors were encountered: