]> gerrit.simantics Code Review - simantics/3d.git/commitdiff
Fix getRealPosition() for control points 10/3710/1 release/1.35.2 release/1.35.3
authorReino Ruusu <reino.ruusu@semantum.fi>
Thu, 12 Dec 2019 13:55:39 +0000 (15:55 +0200)
committerMarko Luukkainen <marko.luukkainen@semantum.fi>
Thu, 12 Dec 2019 14:26:42 +0000 (14:26 +0000)
gitlab #69

Change-Id: Iade27e651baddff4d0a3138d2f7fc85391f2dcbb
(cherry picked from commit 5c3ab621af42b395803bfab9e6b72244dc2db633)

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

index e240dc585426b972dd93a42174ce99e24f4403c1..b67562459016b3dddcb1ba730a99a1a5bb016beb 100644 (file)
@@ -15,7 +15,6 @@ import javax.vecmath.Vector3d;
 import org.simantics.g3d.math.MathTools;
 import org.simantics.g3d.property.annotations.GetPropertyValue;
 import org.simantics.g3d.scenegraph.G3DNode;
-import org.simantics.g3d.scenegraph.base.ParentNode;
 import org.simantics.plant3d.scenegraph.IP3DNode;
 import org.simantics.plant3d.scenegraph.Nozzle;
 import org.simantics.plant3d.scenegraph.P3DRootNode;
@@ -1039,16 +1038,27 @@ public class PipeControlPoint extends G3DNode implements IP3DNode {
                Vector3d pos = getWorldPosition();
                switch (type) {
                case NEXT: {
-                       Vector3d dir = getInlineDir();
                        double length = getInlineLength();
+                       Vector3d dir;
+                       if (isInline()) {
+                               dir = getInlineDir();
+                       } else {
+                               dir = getPathLegDirection(Direction.NEXT);
+                       }
                        dir.scale(length);
                        pos.add(dir);
                        break;
                }
                case PREVIOUS: {
-                       Vector3d dir = getInlineDir();
                        double length = getInlineLength();
-                       dir.scale(-length);
+                       Vector3d dir;
+                       if (isInline()) {
+                               dir = getInlineDir();
+                               dir.negate();
+                       } else {
+                               dir = getPathLegDirection(Direction.PREVIOUS);
+                       }
+                       dir.scale(length);
                        pos.add(dir);
                        break;
                }