]> gerrit.simantics Code Review - simantics/3d.git/blobdiff - org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/controlpoint/PipeControlPoint.java
Introduce orientToDirection() method to pipe control point
[simantics/3d.git] / org.simantics.plant3d / src / org / simantics / plant3d / scenegraph / controlpoint / PipeControlPoint.java
index c5bf29ddd5798d06175f9e6c6d90e6f078e16cf7..fdb413ee39316b1cbc0652a4e2360c0ceb105b39 100644 (file)
@@ -1614,6 +1614,21 @@ public class PipeControlPoint extends G3DNode implements IP3DNode {
                updateSubPoint();
        }
 
+       public void orientToDirection(Vector3d dir) {
+               Double angleO = getRotationAngle();
+               double angle = 0.0;
+               if (angleO != null)
+                       angle = angleO;
+               boolean reversed = _getReversed();
+               Quat4d q = null;
+               if (dir != null) {
+                   q = getControlPointOrientationQuat(dir, angle, reversed);
+               } else {
+                   q = getControlPointOrientationQuat(angle, reversed);
+               }
+               setWorldOrientation(q);
+       }
+
        @Override
        public String toString() {
                return getClass().getName() + "@" + Integer.toHexString(hashCode());