Java Angle Difference angleDifference(double angle1, double angle2)

Here you can find the source of angleDifference(double angle1, double angle2)

Description

Returns the difference between the two angles in degrees (-180 to 180).

License

Open Source License

Declaration

public static double angleDifference(double angle1, double angle2) 

Method Source Code

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

public class Main {
    /** Returns the difference between the two angles in degrees (-180 to 180). */
    public static double angleDifference(double angle1, double angle2) {
        return ((angle2 - angle1) % 360 + 540) % 360 - 180;
    }//w  w w .  j a va 2s  .  c o m
}

Related

  1. angleDiff(float a, float b)
  2. angleDiff(int ang1, int ang2)
  3. angleDiff(int angle1, int angle2)
  4. angleDiff360(final double angleOne, final double angleTwo)
  5. angleDiffAbs(double a, double b)
  6. angleDifference(final int alpha, final int beta)