Java Utililty Methods atan2

List of utility methods to do atan2

Description

The list of methods to do atan2 are organized into topic(s).

Method

doubleatan2(double arg1, double arg2)
atan
if (arg1 + arg2 == arg1) {
    if (arg1 >= 0) {
        return PIO2;
    return -PIO2;
arg1 = atan(arg1 / arg2);
if (arg2 < 0) {
...
doubleatan2(double x, double y)
Approximates the atan2 function.
if (y == 0.0 && x == 0.0) {
    return 0.0;
} else if (x > 0.0) {
    if (y > 0.0) { 
        return atan(y / x);
    } else { 
        return 2 * Math.PI - atan(-y / x);
} else if (x < 0.0) {
    if (y < 0.0) { 
        return Math.PI + atan(y / x);
    } else { 
        return Math.PI - atan(-y / x);
} else if (y < 0.0) { 
    return 2 * Math.PI - Math.PI / 2.;
} else {
    return Math.PI / 2.;
doubleatan2(double y, double x)
Converts rectangular coordinates (xy) to polar (r, theta).
return Math.atan2(y, x);
doubleatan2(double y, double x)
Converts rectangular coordinates (x, y) to polar (r, theta).
double pi_o_4 = 7.8539816339744827900E-01; 
double pi_o_2 = 1.5707963267948965580E+00; 
double pi = 3.1415926535897931160E+00; 
double pi_lo = 1.2246467991473531772E-16; 
double z;
int k, m;
long hx = Double.doubleToLongBits(x);
long hy = Double.doubleToLongBits(y);
...
doubleatan2(double y, double x)
atan
if (y == 0. && x == 0.)
    return 0.;
if (x > 0.)
    return atan(y / x);
if (x < 0.) {
    if (y < 0.)
        return -(Math.PI - atan(y / x));
    else
...
doubleatan2(double y, double x)
atan
double atn = atan(y / x);
if (y >= 0) {
    if (x >= 0)
        return atn;
    return Math.PI + atn;
if (x >= 0) {
    return atn;
...
double[]atan2(double[] arr1, double[] arr2)
atan
double[] result = new double[arr1.length];
for (int i = 0; i < arr1.length; i++) {
    result[i] = Math.atan2(arr2[i], arr1[i]);
return result;
doubleatan2(final double y, final double x)
atan
return StrictMath.atan2(y, x);
floatatan2(float y, float x)
Returns atan2 in radians, faster but less accurate than Math.atan2.
if (x == 0f) {
    if (y > 0f)
        return PI / 2;
    if (y == 0f)
        return 0f;
    return -PI / 2;
final float atan, z = y / x;
...
doubleatan2(Integer y, Integer x)
atan
return Math.atan2(y.doubleValue(), x.doubleValue());