From: Reino Ruusu Date: Thu, 12 Dec 2019 13:55:39 +0000 (+0200) Subject: Fix getRealPosition() for control points X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F10%2F3710%2F1;p=simantics%2F3d.git Fix getRealPosition() for control points gitlab #69 Change-Id: Iade27e651baddff4d0a3138d2f7fc85391f2dcbb (cherry picked from commit 5c3ab621af42b395803bfab9e6b72244dc2db633) --- diff --git a/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/controlpoint/PipeControlPoint.java b/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/controlpoint/PipeControlPoint.java index e240dc58..b6756245 100644 --- a/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/controlpoint/PipeControlPoint.java +++ b/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/controlpoint/PipeControlPoint.java @@ -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; }