Nixed mirrorAngleOrigin because it's not correct.

The correct way to mirror an angle in [-PI, PI] around the x-axis is simply to
negate it, which doesn't seem ceremonious enough to require a utility method.
This commit is contained in:
Michael Bayne
2013-02-12 17:27:23 -08:00
parent 0a388b65aa
commit fc4cf07ca3
3 changed files with 0 additions and 23 deletions
-9
View File
@@ -174,15 +174,6 @@ public class MathUtil
return (a > 0f ? Math.PI : -Math.PI) - a; return (a > 0f ? Math.PI : -Math.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 double mirrorAngleOrigin (double a) {
return a + (a > 0f ? -Math.PI : Math.PI);
}
/** /**
* Sets the number of decimal places to show when formatting values. By default, they are * Sets the number of decimal places to show when formatting values. By default, they are
* formatted to three decimal places. * formatted to three decimal places.
-9
View File
@@ -174,15 +174,6 @@ public class MathUtil
return (a > 0f ? FloatMath.PI : -FloatMath.PI) - 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);
}
/** /**
* Sets the number of decimal places to show when formatting values. By default, they are * Sets the number of decimal places to show when formatting values. By default, they are
* formatted to three decimal places. * formatted to three decimal places.
@@ -30,9 +30,4 @@ public class MathUtilTest
assertEquals(MathUtil.lerpa(3*PI4, -3*PI4, 0.5f), -PI, MathUtil.EPSILON); assertEquals(MathUtil.lerpa(3*PI4, -3*PI4, 0.5f), -PI, MathUtil.EPSILON);
} }
@Test public void testMirrorAngleOrigin() {
assertEquals(-PI2, MathUtil.mirrorAngleOrigin(PI2), MathUtil.EPSILON);
assertEquals(PI2, MathUtil.mirrorAngleOrigin(-PI2), MathUtil.EPSILON);
}
} }