From 5c3ab621af42b395803bfab9e6b72244dc2db633 Mon Sep 17 00:00:00 2001 From: Reino Ruusu Date: Thu, 12 Dec 2019 15:55:39 +0200 Subject: [PATCH] Fix getRealPosition() for control points gitlab #69 Change-Id: Iade27e651baddff4d0a3138d2f7fc85391f2dcbb --- .../controlpoint/PipeControlPoint.java | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) 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; } -- 2.47.1