From 331dedf8ea2da8789bf5f1e720c306bc2094af53 Mon Sep 17 00:00:00 2001 From: Reino Ruusu Date: Thu, 20 Feb 2020 18:27:26 +0200 Subject: [PATCH] Fix cause of endless loop in overlap resolution gitlab #86 Change-Id: I256a7c12e168410ef2ff3be4c08a77208448734b --- .../plant3d/scenegraph/controlpoint/PipingRules.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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 { -- 2.45.2