From: Reino Ruusu Date: Thu, 20 Feb 2020 16:27:26 +0000 (+0200) Subject: Fix cause of endless loop in overlap resolution X-Git-Tag: v1.43.0~67 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=331dedf8ea2da8789bf5f1e720c306bc2094af53;p=simantics%2F3d.git Fix cause of endless loop in overlap resolution gitlab #86 Change-Id: I256a7c12e168410ef2ff3be4c08a77208448734b --- diff --git a/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/controlpoint/PipingRules.java b/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/controlpoint/PipingRules.java index cb820072..2c77c2bf 100644 --- a/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/controlpoint/PipingRules.java +++ b/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/controlpoint/PipingRules.java @@ -759,7 +759,7 @@ public class PipingRules { continue; double curr = gapObj.d; int d = 1; - while (curr < -MIN_INLINE_LENGTH) { + while (d < gaps.size() && curr < -MIN_INLINE_LENGTH) { GapObj next = i+d >= 0 ? gaps.get(i+d) : null; GapObj prev = i-d >= 0 ? gaps.get(i-d) : null; if (next != null && next.gap == Gap.SPACE) { @@ -778,7 +778,7 @@ public class PipingRules { pcp.first.setWorldPosition(p); } } - if (curr < -MIN_INLINE_LENGTH && prev != null && prev.gap == Gap.SPACE) { + else if (prev != null && prev.gap == Gap.SPACE) { double move = Math.min(-curr, prev.d); curr+= move; prev.d -= move; @@ -794,6 +794,9 @@ public class PipingRules { pcp.first.setWorldPosition(p); } } + else { + d++; + } } } } else {