normalizeAngle static method
Normalizes the given angle
(in radians) to the range of -pi to pi.
Implementation
static double normalizeAngle(double angle) {
angle = angle % pi2;
if (angle < -Math.PI) {
angle += pi2;
}
if (angle > Math.PI) {
angle -= pi2;
}
return angle;
}