- double currentLength = icp.getLength();
- Vector3d currentPos = icp.getWorldPosition();
- Vector3d prevPos = prev.getWorldPosition();
-
- Vector3d dir = new Vector3d();
- dir.sub(currentPos, prevPos);
-
- if (currentLength < MathTools.NEAR_ZERO) {
- currentLength = (dir.length() - prev.getInlineLength()) * 2.0;
- }
-
- if (dir.lengthSquared() > MathTools.NEAR_ZERO)
- dir.normalize();
- Point3d endPos = new Point3d(dir);
- endPos.scale(currentLength * 0.5);
- endPos.add(currentPos); // this is the free end of the
- // component
-
- double offset = prev.getInlineLength();
- Point3d beginPos = new Point3d(dir);
- beginPos.scale(offset);
- beginPos.add(prevPos); // this is the connected end of
- // the component
-
- double l = beginPos.distance(endPos);
-
- if (Double.isNaN(l))
- System.out.println("Length for " + icp + " is NaN");
-
- dir.scale(l * 0.5);
- beginPos.add(dir); // center position
-
- if (DEBUG)
- System.out.println("PipingRules.updateInlineControlPoints() setting variable length to " + l);
- icp.setLength(l);
-
- icp.setWorldPosition(new Vector3d(beginPos));
+ Vector3d currentPos = icp.getWorldPosition();
+ Vector3d prevPos = prev.getWorldPosition();
+
+ Vector3d dir = new Vector3d();
+ dir.sub(currentPos, prevPos);
+
+ boolean simple = true;
+ if (simple) {
+ double currentLength = (dir.length() - prev.getInlineLength()) * 2.0;
+ icp.setLength(currentLength);
+ } else {
+ double currentLength = icp.getLength();
+ if (currentLength < MathTools.NEAR_ZERO) {
+ currentLength = (dir.length() - prev.getInlineLength()) * 2.0;
+ }
+
+ if (dir.lengthSquared() > MathTools.NEAR_ZERO)
+ dir.normalize();
+ Point3d endPos = new Point3d(dir);
+ endPos.scale(currentLength * 0.5);
+ endPos.add(currentPos); // this is the free end of the component
+
+ double offset = prev.getInlineLength();
+ Point3d beginPos = new Point3d(dir);
+ beginPos.scale(offset);
+ beginPos.add(prevPos); // this is the connected end of the component
+
+ double l = beginPos.distance(endPos);
+
+ if (Double.isNaN(l))
+ System.out.println("Length for " + icp + " is NaN");
+
+ dir.scale(l * 0.5);
+ beginPos.add(dir); // center position
+
+ if (DEBUG)
+ System.out.println("PipingRules.updateInlineControlPoints() setting variable length to " + l);
+ icp.setLength(l);
+
+ icp.setWorldPosition(new Vector3d(beginPos));
+ }