@Test public void testDoubleMod() { assertEquals(350.0, MathUtils.mod(-730.0, 360.0), 0.0); assertEquals( 0.0, MathUtils.mod(-720.0, 360.0), 0.0); assertEquals( 10.0, MathUtils.mod(-710.0, 360.0), 0.0); assertEquals(350.0, MathUtils.mod(-370.0, 360.0), 0.0); assertEquals( 0.0, MathUtils.mod(-360.0, 360.0), 0.0); assertEquals( 10.0, MathUtils.mod(-350.0, 360.0), 0.0); assertEquals(350.0, MathUtils.mod( -10.0, 360.0), 0.0); assertEquals( 0.0, MathUtils.mod( 0.0, 360.0), 0.0); assertEquals( 10.0, MathUtils.mod( 10.0, 360.0), 0.0); assertEquals(350.0, MathUtils.mod( 350.0, 360.0), 0.0); assertEquals( 0.0, MathUtils.mod( 360.0, 360.0), 0.0); assertEquals( 10.0, MathUtils.mod( 370.0, 360.0), 0.0); assertEquals(350.0, MathUtils.mod( 710.0, 360.0), 0.0); assertEquals( 0.0, MathUtils.mod( 720.0, 360.0), 0.0); assertEquals( 10.0, MathUtils.mod( 730.0, 360.0), 0.0); }
public static float mod(float a, float b) { if (a < 0) { return a + (float) Math.ceil(-a / b) * b; } else if (a >= b) { return a - (float) Math.floor(a / b) * b; } else { return a; } }
MathUtils { public static float mod(float a, float b) { if (a < 0) { return a + (float) Math.ceil(-a / b) * b; } else if (a >= b) { return a - (float) Math.floor(a / b) * b; } else { return a; } } }
MathUtils { public static float mod(float a, float b) { if (a < 0) { return a + (float) Math.ceil(-a / b) * b; } else if (a >= b) { return a - (float) Math.floor(a / b) * b; } else { return a; } } private  MathUtils(); }
MathUtils { public static float mod(float a, float b) { if (a < 0) { return a + (float) Math.ceil(-a / b) * b; } else if (a >= b) { return a - (float) Math.floor(a / b) * b; } else { return a; } } private  MathUtils(); static int pow(int x, int y); static float mod(float a, float b); static double mod(double a, double b); static int mod(int a, int b); static float getDistance(int x1, int y1, int x2, int y2); static float getDistance(int x1, int y1, int z1, int x2, int y2, int z2); static float getDistance(int dx, int dy); static float getDistance(float dx, float dy); static float getDistance(float dx, float dy, float dz); static float getDistance(int dx, int dy, int dz); static int clamp(int min, int value, int max); static float clamp(float min, float value, float max); static double clamp(double min, double value, double max); static Vector3d rotateVectorCC(Vector3d vector, Vector3d axis, double angle); static double distanceToLineSegment(int px, int py, int vx, int vy, int wx, int wy); }
MathUtils { public static float mod(float a, float b) { if (a < 0) { return a + (float) Math.ceil(-a / b) * b; } else if (a >= b) { return a - (float) Math.floor(a / b) * b; } else { return a; } } private  MathUtils(); static int pow(int x, int y); static float mod(float a, float b); static double mod(double a, double b); static int mod(int a, int b); static float getDistance(int x1, int y1, int x2, int y2); static float getDistance(int x1, int y1, int z1, int x2, int y2, int z2); static float getDistance(int dx, int dy); static float getDistance(float dx, float dy); static float getDistance(float dx, float dy, float dz); static float getDistance(int dx, int dy, int dz); static int clamp(int min, int value, int max); static float clamp(float min, float value, float max); static double clamp(double min, double value, double max); static Vector3d rotateVectorCC(Vector3d vector, Vector3d axis, double angle); static double distanceToLineSegment(int px, int py, int vx, int vy, int wx, int wy); static final double TWO_PI; }