Java Utililty Methods Angle Difference

List of utility methods to do Angle Difference

Description

The list of methods to do Angle Difference are organized into topic(s).

Method

doubleangleDiff360(final double angleOne, final double angleTwo)
angle Diff
if (angleOne < 0D || angleOne > 360D) {
    throw new IllegalArgumentException(
            "angle one ( " + angleOne + " ) is out of bounds, should be between 0 and 360");
if (angleTwo < 0D || angleTwo > 360D) {
    throw new IllegalArgumentException(
            "angle one ( " + angleTwo + " ) is out of bounds, should be between 0 and 360");
final double temp = Math.abs(angleOne - angleTwo);
return Math.min(temp, 360D - temp);
doubleangleDiffAbs(double a, double b)
given two angels in radians, returns a difference in radians closest to zero and >= zero.
return Math.abs(angleDiff(a, b));
doubleangleDifference(double angle1, double angle2)
Returns the difference between the two angles in degrees (-180 to 180).
return ((angle2 - angle1) % 360 + 540) % 360 - 180;
intangleDifference(final int alpha, final int beta)
Length (angular) of a shortest way between two angles.
final int phi = Math.abs(beta - alpha) % 360; 
return phi > 180 ? 360 - phi : phi;