List of utility methods to do Angle Difference
double | angleDif(double a1, double a2) Compute the difference between two angles. double val = a1 - a2; if (val > Math.PI) { val -= 2. * Math.PI; if (val < -Math.PI) { val += 2. * Math.PI; return val; ... |
float | angleDif(float a, float b) angle Dif if (b > a) return b - a > PI ? (float) (a + 2 * PI - b) : b - a; return a - b > PI ? (float) (b + 2 * PI - a) : a - b; |
float | angleDif(float a1, float a2) Compute the difference between two angles. double val = a1 - a2; if (val > Math.PI) { val -= 2. * Math.PI; if (val < -Math.PI) { val += 2. * Math.PI; return (float) val; ... |
double | angleDiff(double a, double b) given two angels in radians, returns a difference in radians closest to zero such that a + angleDiff(a, b) represents b. return angleDiff(a, b, Math.PI * 2);
|
double | angleDiff(double alpha, double beta) angle Diff double angleDiff = alpha - beta; return ((((angleDiff) % (2 * Math.PI)) + (3 * Math.PI)) % (2 * Math.PI)) - Math.PI; |
double | angleDiff(double angle1, double angle2, boolean normalized) angle Diff if (!normalized) { angle1 = normalizeAngle(angle1); angle2 = normalizeAngle(angle2); return Math.min(Math.abs(angle1 - angle2), Math.min(Math.abs(angle1 - angle2 + TWO_PI), Math.abs(angle1 - angle2 - TWO_PI))); |
double | angleDiff(final double a1, final double a2) Get the difference of angles (radians) as given from angle(x,z), from a1 to a2, i.e. if (Double.isNaN(a1) || Double.isNaN(a1)) return Double.NaN; final double diff = a2 - a1; if (diff < -Math.PI) return diff + 2.0 * Math.PI; else if (diff > Math.PI) return diff - 2.0 * Math.PI; else ... |
float | angleDiff(float a, float b) Returns the smallest signed difference between the two given angles, from a to b. return reduceAngle(b - a);
|
int | angleDiff(int ang1, int ang2) angle Diff int delta = ang2 - ang1; delta %= ANGLE_2PI; if (delta < 0) delta += ANGLE_2PI; if (delta > ANGLE_PI) delta -= ANGLE_2PI; return delta; |
double | angleDiff(int angle1, int angle2) angle Diff double diff = Math.abs(angle1 - angle2); if (diff <= 180) { return diff; } else { return 360 - diff; |