Make the upper bound exclusive in normalizeAngle(Positive).

This commit is contained in:
Michael Bayne
2011-11-22 16:41:45 -08:00
parent 274dd1858d
commit 060ff1b877
2 changed files with 8 additions and 8 deletions
+4 -4
View File
@@ -138,26 +138,26 @@ public class MathUtil
}
/**
* Returns an angle in the range [-pi, pi].
* Returns an angle in the range [-pi, pi).
*/
public static double normalizeAngle (double a) {
while (a < -Math.PI) {
a += TWO_PI;
}
while (a > Math.PI) {
while (a >= Math.PI) {
a -= TWO_PI;
}
return a;
}
/**
* Returns an angle in the range [0, 2pi].
* Returns an angle in the range [0, 2pi).
*/
public static double normalizeAnglePositive (double a) {
while (a < 0f) {
a += TWO_PI;
}
while (a > TWO_PI) {
while (a >= TWO_PI) {
a -= TWO_PI;
}
return a;
+4 -4
View File
@@ -138,26 +138,26 @@ public class MathUtil
}
/**
* Returns an angle in the range [-pi, pi].
* Returns an angle in the range [-pi, pi).
*/
public static float normalizeAngle (float a) {
while (a < -FloatMath.PI) {
a += TWO_PI;
}
while (a > FloatMath.PI) {
while (a >= FloatMath.PI) {
a -= TWO_PI;
}
return a;
}
/**
* Returns an angle in the range [0, 2pi].
* Returns an angle in the range [0, 2pi).
*/
public static float normalizeAnglePositive (float a) {
while (a < 0f) {
a += TWO_PI;
}
while (a > TWO_PI) {
while (a >= TWO_PI) {
a -= TWO_PI;
}
return a;