public double convertAzimuth2xaxisAngle(double azimuth) {
        if (Double.compare(azimuth, 360) > 0 || Double.compare(azimuth, 0) < 0) {
            throw new IllegalArgumentException("Azimuth " + azimuth + " must be in (0, 360)");
        }
        double angleXY = PI_2 - azimuth / 180. * Math.PI;
        if (angleXY < -Math.PI)
            angleXY += 2 * Math.PI;
        if (angleXY > Math.PI)
            angleXY -= 2 * Math.PI;
        return angleXY;
    }
public double convertAzimuth2xaxisAngle ( double azimuth ) { if ( Double . compare ( azimuth , 360 ) > 0 || Double . compare ( azimuth , 0 ) < 0 ) { throw new IllegalArgumentException ( "Azimuth " + azimuth + " must be in (0, 360)" ) ; } double angleXY = PI_2 - azimuth / 180. * Math . PI ; if ( angleXY < - Math . PI ) angleXY += 2 * Math . PI ; if ( angleXY > Math . PI ) angleXY -= 2 * Math . PI ; return angleXY ; }
convert north based clockwise azimuth (0, 360) into x-axis/east based angle (-Pi, Pi)