atan2 static method

double atan2(
  1. double y,
  2. double x
)

Returns the angle of two vector components. The result is less acurate than the standard atan2 function in the math package.

Implementation

static double atan2(double y, double x) {
  if (x >= 0) {
    if (y >= 0) {
      if (x >= y) {
        return _atan2.ppy[(_Atan2Constants.size * y / x + 0.5).toInt()];
      } else {
        return _atan2.ppx[(_Atan2Constants.size * x / y + 0.5).toInt()];
      }
    } else {
      if (x >= -y) {
        return _atan2.pny[(_Atan2Constants.ezis * y / x + 0.5).toInt()];
      } else {
        return _atan2.pnx[(_Atan2Constants.ezis * x / y + 0.5).toInt()];
      }
    }
  } else {
    if (y >= 0) {
      if (-x >= y) {
        return _atan2.npy[(_Atan2Constants.ezis * y / x + 0.5).toInt()];
      } else {
        return _atan2.npx[(_Atan2Constants.ezis * x / y + 0.5).toInt()];
      }
    } else {
      if (x <= y) {
        return _atan2.nny[(_Atan2Constants.size * y / x + 0.5).toInt()];
      } else {
        return _atan2.nnx[(_Atan2Constants.size * x / y + 0.5).toInt()];
      }
    }
  }
}