}
/**
- * Returns direction vector.
+ * Returns direction vector pointing towards an adjacent component for
+ * directed control points or turn control points with one open end.
*
- * For directed control points, always returns outwards pointing vector.
+ * Always returns an outwards pointing vector.
+ *
+ * For any other type of component, the return value is null.
+ *
+ * For turn components this only return a non-null value for the unconnected
+ * end of the component.
*
* @param direction
* @return normalized vector, or null
Vector3d offset = new Vector3d();
MathTools.rotate(q2, v, offset);
MathTools.rotate(q, offset, dir);
+ dir.negate();
dir.normalize();
return dir;
}
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());