]> gerrit.simantics Code Review - simantics/3d.git/commitdiff
Yesterdays change introduced infinite loop for directed path leg updates 74/3674/1
authorMarko Luukkainen <marko.luukkainen@semantum.fi>
Thu, 5 Dec 2019 09:07:58 +0000 (11:07 +0200)
committerMarko Luukkainen <marko.luukkainen@semantum.fi>
Thu, 5 Dec 2019 09:27:32 +0000 (09:27 +0000)
Fine tuned elbow space calculation.

gitlab #14

Change-Id: Ic0505c5e55d0f90f41bcdd7f8b26d11d189d6582
(cherry picked from commit a899aac9dd52296206f302a20a8e7bae2501cf2c)

org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/controlpoint/PipingRules.java

index 58873b0f1003d5f64156b3c16a42def1cb8cccd4..57ee4ba86a382e9ac49ed7253ccdaf03f0a248e4 100644 (file)
@@ -864,7 +864,8 @@ public class PipingRules {
                double l2next = icp.getInlineLength();
                double l2 = l2prev + l2next;
                double l2s = l2 * l2;
-               if (l > l2s) {
+               double diff = l - l2s;
+               if (diff >= MIN_INLINE_LENGTH) {
                        if (allowInsertRemove) {
                                dir.normalize();
                                double length = Math.sqrt(l) - l2; // true length of the variable length component
@@ -988,16 +989,19 @@ public class PipingRules {
                        other = u.end;
                        position = u.startPoint;
                        dcpStart = true;
+                       if (!u.reversed)
+                canMoveOther = true;
                        inlineEnd = u.end.isInline();
                                
                } else {
                        dcp = u.end;
                        other = u.start;
                        position = u.endPoint;
+                       if (u.reversed)
+                canMoveOther = true;
                        inlineEnd = u.start.isInline();
                }
-               canMoveOther = !(other == u.updated);
-
+               
                Vector3d directedDirection = direction(dcp, dcpStart ? Direction.NEXT : Direction.PREVIOUS);
                if (directedDirection == null) {
                        //updateTurnControlPointTurn(dcp, dcp.getPrevious(), dcp.getNext());
@@ -1286,7 +1290,7 @@ public class PipingRules {
                    R = tr / t;
                if (R <= curr)
                    break;
-               curr = R*1.01;
+               curr = R*1.001;
                iter--;
            }
            return curr;