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;
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;
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())
}
/**
- * 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
Vector3d offset = new Vector3d();
MathTools.rotate(q2, v, offset);
MathTools.rotate(q, offset, dir);
+ dir.negate();
dir.normalize();
return dir;
}
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);
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());