MathUtils { public static double normalizeAngle(double a, double center) { return a - TWO_PI * FastMath.floor((a + FastMath.PI - center) / TWO_PI); } private  MathUtils(); static int hash(double value); static boolean equals(double x, double y); static int hash(double[] value); static double normalizeAngle(double a, double center); static double reduce(double a,
                                double period,
                                double offset); static byte copySign(byte magnitude, byte sign); static short copySign(short magnitude, short sign); static int copySign(int magnitude, int sign); static long copySign(long magnitude, long sign); static void checkFinite(final double x); static void checkFinite(final double[] val); static void checkNotNull(Object o,
                                    Localizable pattern,
                                    Object ... args); static void checkNotNull(Object o); static final double TWO_PI; static final double PI_SQUARED; }
@Test public void testNormalizeAngle() { for (double a = -15.0; a <= 15.0; a += 0.1) { for (double b = -15.0; b <= 15.0; b += 0.2) { double c = MathUtils.normalizeAngle(a, b); Assert.assertTrue((b - FastMath.PI) <= c); Assert.assertTrue(c <= (b + FastMath.PI)); double twoK = FastMath.rint((a - c) / FastMath.PI); Assert.assertEquals(c, a - twoK * FastMath.PI, 1.0e-14); } } }