Java Angle angleSum(float a1, float a2)

Here you can find the source of angleSum(float a1, float a2)

Description

Sum of two angles.

License

Apache License

Declaration

public static float angleSum(float a1, float a2) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    /** Sum of two angles.
     * The resulting angle is in the range of -pi..+pi if the input angle are
     * also in this range./*from ww  w  .j  a v a 2s . c om*/
     */
    public static float angleSum(float a1, float a2) {
        double val = a1 + a2;
        if (val > Math.PI) {
            val -= 2. * Math.PI;
        }
        if (val < -Math.PI) {
            val += 2. * Math.PI;
        }
        return (float) val;
    }
}

Related

  1. angleLinear(float a, float b, int spin, float f)
  2. angleOfLine(int x1, int y1, int x2, int y2)
  3. angleOfLineDeg(double x1, double y1, double x2, double y2)
  4. angleRadToDegClipped(final double angleRad)
  5. anglesInvalid(double sza, double vza, double saa, double vaa)
  6. angleTo(final int x, final int y, final int thatx, final int thaty)
  7. angleToCompass(double angleIn)
  8. angleToDefaultAngle(double angle)
  9. angleToFacing(float angle)