+ }
+
+ private void convertVariableAngleToFixed(Direction direction) {
+ // We are removing reference, which transforms variable angle to fixed angle.
+ // Since fixed angle is defined differently, we need to calculate fixed angle parameters based on current data
+ // We need to calculate turnAngle and rotationAngle
+ Vector3d dirOut = getPathLegDirection(direction == Direction.NEXT ? Direction.NEXT : Direction.PREVIOUS);
+ Vector3d dir = getPathLegDirection(direction == Direction.NEXT ? Direction.PREVIOUS : Direction.NEXT);
+ dir.negate();
+ dirOut.normalize();
+ dir.normalize();
+ double angle = dir.angle(dirOut);
+ //super._setNext(null);
+ if (direction == Direction.NEXT)
+ next = null;
+ else
+ previous = null;
+ setRotationAngle(0.0);
+ setReversed(direction == Direction.NEXT ? false : true);
+ Vector3d dirOutN = getPathLegDirection(direction == Direction.NEXT ? Direction.NEXT : Direction.PREVIOUS);
+ dirOutN.normalize();
+ AxisAngle4d aa = new AxisAngle4d();
+ if (MathTools.createRotation(dirOutN, dirOut, dir, aa)) {
+ setRotationAngle(aa.angle);
+ setTurnAngle(angle);
+ }