shortRotation static method
Shortens the given rotation
angle to the range of -pi to pi.
Implementation
static double shortRotation(double rotation) {
if (rotation < -Math.PI) {
rotation += pi2;
} else if (rotation > Math.PI) {
rotation -= pi2;
}
return rotation;
}