Skip to content
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

Zero length segments created #35

Open
lgpmichael2 opened this issue Sep 21, 2021 · 1 comment
Open

Zero length segments created #35

lgpmichael2 opened this issue Sep 21, 2021 · 1 comment

Comments

@lgpmichael2
Copy link

Hi,

OK so I've been having issues where I was getting zero length segments. They were created by either difference or intersect, not sure which, the path of creating them was a bit obscure (several hundred polygons some with thousands of vertices being operated on).

None of the initial polygons had a zero length segment, I checked that, but they ended up with some

So, I added the following. It SEEMS to be working and by the looks of it should be safe, but I'd like someone who knows more of the inner workings to verify there are no side effects before I create a PR.

--- js/polybool.js.crash        2021-09-21 08:31:22.649552763 +0100
+++ js/polybool.js      2021-09-21 07:18:43.756997472 +0100
@@ -882,6 +882,15 @@
 
                        if (ev.isStart){
 
+                           if (ev.pt[0]==ev.other.pt[0] &&
+                               ev.pt[1]==ev.other.pt[1])
+                           {
+                               //Identical, drop it
+                               ev.other.remove();
+                               ev.remove();
+                               continue;
+                           }
+
                                if (buildLog)
                                        buildLog.segmentNew(ev.seg, ev.primary);

@velipso
Copy link
Owner

velipso commented Sep 21, 2021

Thanks!

Unfortunately, I really haven't looked at this code in a long time, so I don't have the context in my head anymore. If it's okay, I'll just leave this ticket open so if someone else wants to try out the patch, they have the information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants