Java examples for java.lang:Math Geometry
Sum of two angles.
//package com.java2s; 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.//ww w . ja va 2 s . com */ 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; } }