-
-
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
infinite loop during intersection #98
Comments
Hmm, even with that uncommented I'm still getting infinite loops on other geometry. e.g. martinez.intersection([[-36.24781525291243, 28.240373566184424],[-5.276960407892941, 69.94177839542625],[-10.689741059141994, 70.14384722952903],[10.59203885271558, 26.42123891266195],[9.619931709858415, 41.63423842491253],[-61.1981865514771, 44.346933376701756], [-36.24781525291243, 28.240373566184424]], [[-5.276960407892941, 69.94177839542625],[-36.24781525291243, 28.240373566184424],[-28.04892431686142, 27.43688541864268],[-5.276960407892941, 69.94177839542625]]) |
that line doesn't have much to do with it. As the comment suggests, it just stops at the first self-intersection |
I don't know why or how, but I came here from w8r/polygon-offset#14 since the infinite loop seems to be originating from this library, but commenting that line out seems to fix the issue. For what I use this library it's okay that some results may be wonky so I'll take any side effects in stride. Still, if there's some sort of proper fix for this I'd be happy to know. For now I'll fork and apply the above fix as that seemed to work. |
I found another case of infinite loop when intersecting, in my case it's stuck in connect_edges > orderEvents. |
Thank you!
…On Fri, 30 Sept 2022 at 13:01, Cătălin Tătuță ***@***.***> wrote:
I found another case of infinite loop when intersecting, in my case it's
stuck in connect_edges > orderEvents.
Taking a look at the actual polygons it seems they share a pretty big
chunk of a border, and I suspect this is why it's having issues sorting
them.
[image: Screenshot 2022-09-30 at 13 59 11]
<https://user-images.githubusercontent.com/80847665/193255789-3a2b20d7-c860-4f5c-ba4d-5b154bf39019.png>
I'm also attaching a file with the 2 polygons
test.js.zip <https://github.com/w8r/martinez/files/9683518/test.js.zip>
—
Reply to this email directly, view it on GitHub
<#98 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAGSBAXLHDOU4JAP3OESSTWA3CALANCNFSM4GTQAYZA>
.
You are receiving this because you were assigned.Message ID:
***@***.***>
|
I seem to be seeing the same issue when unioning shapes with some overlapping edges - though in my case, intersection works fine! Here's a reproduction: https://codepen.io/crabmusket/pen/VwqbWXW I wonder if I could patch this issue for my use case by randomly jiggling the vertices a little bit. But I'd prefer to dig into the cause and fix it if possible. I'm not sure why this would be such a problem 🤔 |
causes an infinite loop inside 'subdivide' function due to possibleIntersection not handling the case of a self-intersecting polygon. There's even a commented-out line that when reactivated seems to solve this issue.
This loop badly hangs the browser when it's hit.
The text was updated successfully, but these errors were encountered: