X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.plant3d%2Fsrc%2Forg%2Fsimantics%2Fplant3d%2Fscenegraph%2Fcontrolpoint%2FPipingRules.java;h=2c77c2bfbc9f24f1b9bb5fe89ca37dcb3ca894c1;hb=68314736ee2b8da184a5e01e88b719b4fd64ab49;hp=33c832f1b8c4bec41cc22d5c0d1dec791f6f8968;hpb=192fb6753ee068aaf535daf2626f3821a4c7795a;p=simantics%2F3d.git 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 33c832f1..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,12 +778,12 @@ 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; - next.d -= move; - if (next.d < MIN_INLINE_LENGTH) - next.gap = Gap.ATTACHED; + prev.d -= move; + if (prev.d < MIN_INLINE_LENGTH) + prev.gap = Gap.ATTACHED; Vector3d mv = new Vector3d(dir); mv.normalize(); mv.scale(-move); @@ -794,6 +794,9 @@ public class PipingRules { pcp.first.setWorldPosition(p); } } + else { + d++; + } } } } else { @@ -1901,7 +1904,7 @@ public class PipingRules { return Math.PI; // FIXME : argh } - Quat4d q = PipeControlPoint.getControlPointOrientationQuat(dir, tcp.getRotationAngle() != null ? tcp.getRotationAngle() : 0.0); + Quat4d q = tcp.getControlPointOrientationQuat(dir, tcp.getRotationAngle() != null ? tcp.getRotationAngle() : 0.0); Vector3d v = new Vector3d(); MathTools.rotate(q, MathTools.Y_AXIS,v); tcp.setTurnAxis(v);