shortRotation static method

double shortRotation(
  1. double rotation
)

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;
}