angle_difference

Downloadangle_difference(angle1,angle2)   Returns the difference of the given angles in degress, -180 to 180.
/*
**  usage:
**      diff = angle_difference(angle1,angle2);
**
**  given:
**      angle1    first direction in degrees, real
**      angle2    second direction in degrees, real
**
**  returns:
**      difference of the given angles in degrees, -180 to 180
**
**  GMLscripts.com
*/

{
    return ((((argument0 - argument1) mod 360) + 540) mod 360) - 180;
}

Comments? Click to Comment

Click if you've used this script[Please Login]
Projects: 32