Java Degree Convert to degreesDiff(double a1, double a2)

Here you can find the source of degreesDiff(double a1, double a2)

Description

diff align difference between 2 angles ]-180, 180]

License

Open Source License

Declaration

public static double degreesDiff(double a1, double a2) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**/*from  w  w w.ja va  2s  . co m*/
     * diff align difference between 2 angles ]-180, 180]
     * @return 
     */
    public static double degreesDiff(double a1, double a2) {
        double diff = a1 - a2;
        while (diff > 180) {
            diff -= 360;
        }
        while (diff <= -180) {
            diff += 360;
        }
        return diff;

    }
}

Related

  1. deg2dms(double deg)
  2. degrees(double d)
  3. degrees2Dist(double degrees, double radius)
  4. degreeSin(double angle)
  5. degreesMinSecToDegrees(String position)
  6. degreesToDecimal(String input)
  7. degreesToMetres(double degrees)