| 399 | |
| 400 | |
| 401 | float atan2Fast(float y, float x) |
| 402 | { |
| 403 | // catch singularity. |
| 404 | if ((x == 0) && (y == 0)) return NAN; |
| 405 | |
| 406 | if (x >= 0) |
| 407 | { |
| 408 | if (y >= 0) |
| 409 | { |
| 410 | if (fabs(y) >= fabs(x)) return M_PI / 2 - atanFast(x / y); |
| 411 | return atanFast(y / x); |
| 412 | } |
| 413 | if (fabs(y) >= fabs(x)) return -M_PI / 2 - atanFast(x / y); |
| 414 | return atanFast(y / x); |
| 415 | } |
| 416 | else |
| 417 | { |
| 418 | if (y >= 0) |
| 419 | { |
| 420 | if (fabs(y) >= fabs(x)) return M_PI / 2 - atanFast(x / y); |
| 421 | return M_PI + atanFast(y / x); |
| 422 | } |
| 423 | if (fabs(y) >= fabs(x)) return -M_PI / 2 - atanFast(x / y); |
| 424 | return -M_PI + atanFast(y / x); |
| 425 | } |
| 426 | } |
| 427 | |
| 428 | |
| 429 | /////////////////////////////////////////////////////// |
nothing calls this directly
no test coverage detected