Skip to content

Zero length segments created #35

Description

@lgpmichael2

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);

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions