X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.plant3d%2Fsrc%2Forg%2Fsimantics%2Fplant3d%2Fscenegraph%2Fcontrolpoint%2FPipeControlPoint.java;h=c5934b368edfe64987a79194f0a4a61146543617;hb=refs%2Fchanges%2F88%2F4288%2F1;hp=fdb413ee39316b1cbc0652a4e2360c0ceb105b39;hpb=c6e13a2972fe12620f00f06a97d8746780cb22b1;p=simantics%2F3d.git 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 fdb413ee..c5934b36 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 @@ -481,7 +481,7 @@ public class PipeControlPoint extends G3DNode implements IP3DNode { q = getControlPointOrientationQuat(dir, 0.0); else q = getControlPointOrientationQuat(dir, rotationAngle); - Vector3d v = new Vector3d(0.0,offset,0.0); + Vector3d v = new Vector3d(0.0,-offset,0.0); Vector3d offset = new Vector3d(); MathTools.rotate(q, v, offset); return offset; @@ -493,7 +493,7 @@ public class PipeControlPoint extends G3DNode implements IP3DNode { q = getControlPointOrientationQuat(0.0); else q = getControlPointOrientationQuat(rotationAngle); - Vector3d v = new Vector3d(0.0,offset,0.0); + Vector3d v = new Vector3d(0.0,-offset,0.0); Vector3d offset = new Vector3d(); MathTools.rotate(q, v, offset); return offset; @@ -750,9 +750,6 @@ public class PipeControlPoint extends G3DNode implements IP3DNode { if (pcp.isDualSub()) { pcp.getParentPoint().setNext(this); } - if (isDualInline()) { - getDualSub().setPrevious(this); - } } else { // if direction is previous, user must have given sizechange if (pcp.isDualSub()) @@ -791,9 +788,15 @@ public class PipeControlPoint extends G3DNode implements IP3DNode { } /** - * Returns direction vector. + * Returns direction vector pointing towards an adjacent component for + * directed control points or turn control points with one open end. + * + * Always returns an outwards pointing vector. + * + * For any other type of component, the return value is null. * - * For directed control points, always returns outwards pointing vector. + * For turn components this only return a non-null value for the unconnected + * end of the component. * * @param direction * @return normalized vector, or null @@ -837,6 +840,7 @@ public class PipeControlPoint extends G3DNode implements IP3DNode { Vector3d offset = new Vector3d(); MathTools.rotate(q2, v, offset); MathTools.rotate(q, offset, dir); + dir.negate(); dir.normalize(); return dir; } @@ -947,6 +951,8 @@ public class PipeControlPoint extends G3DNode implements IP3DNode { dir2.scale(length * 0.5); dir1 = new Vector3d(dir2); dir1.negate(); + } else if (isEnd()) { + dir2 = dir1 = new Vector3d(); } else { dir1 = getPathLegDirection(Direction.PREVIOUS); dir2 = sub.getPathLegDirection(Direction.NEXT);