Change new mirrorAngle to mirrorAngleOrigin, improved javadocs.

The old mirrorAngle mirrors around the "y-axis" (PI/2 or -PI/2 as appropriate)
which is necessary for other code (particularly angularDifference) to work
correctly. The new mirrorAngleOrigin mirrors around the "x-axis" (zero).
This commit is contained in:
Michael Bayne
2013-02-12 14:24:04 -08:00
parent 0ffabf1419
commit f26a72c26f
2 changed files with 34 additions and 4 deletions
+12 -1
View File
@@ -166,9 +166,20 @@ public class MathUtil
}
/**
* Returns the mirror angle of the specified angle (assumed to be in [-pi, +pi]).
* Returns the mirror angle of the specified angle (assumed to be in [-pi, +pi]). The angle is
* mirrored around the PI/2 if it is positive, and -PI/2 if it is negative. One can visualize
* this as mirroring around the "y-axis".
*/
public static float mirrorAngle (float a) {
return (a > 0f ? FloatMath.PI : -FloatMath.PI) - a;
}
/**
* Returns the mirror angle of the specified angle (assumed to be in [-pi, +pi]). The angle is
* mirrored around the origin (zero degrees). One can visualize this as mirroring around the
* "x-axis".
*/
public static float mirrorAngleOrigin (float a) {
return a + (a > 0f ? -FloatMath.PI : FloatMath.PI);
}