mirrorAngle(HALF_PI) should be -HALFPI rather than HALF_PI
This commit is contained in:
@@ -169,7 +169,7 @@ 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]).
|
||||||
*/
|
*/
|
||||||
public static float mirrorAngle (float a) {
|
public static float mirrorAngle (float a) {
|
||||||
return (a > 0f ? FloatMath.PI : -FloatMath.PI) - a;
|
return a + (a > 0f ? -FloatMath.PI : FloatMath.PI);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
//
|
||||||
|
// Pythagoras - a collection of geometry classes
|
||||||
|
// http://github.com/samskivert/pythagoras
|
||||||
|
|
||||||
|
package pythagoras.f;
|
||||||
|
|
||||||
|
import org.junit.*;
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests parts of the {@link MathUtil} class.
|
||||||
|
*/
|
||||||
|
public class MathUtilTest
|
||||||
|
{
|
||||||
|
@Test public void testMirrorAngle() {
|
||||||
|
assertEquals(-MathUtil.HALF_PI, MathUtil.mirrorAngle(MathUtil.HALF_PI), MathUtil.EPSILON);
|
||||||
|
assertEquals(MathUtil.HALF_PI, MathUtil.mirrorAngle(-MathUtil.HALF_PI), MathUtil.EPSILON);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user