atan2

atan2(number y, number x) → real result
Converts Cartesian coordinates (x, y) to polar coordinates (r, theta). This function returns the angle theta between -PI and PI using the signs of x and y to determine the quadrant.

Converts the Cartesian coordinates (x*, *y) into polar coordinates (r*, *theta). This function returns the angle theta, between -PI and PI, using the signs of the arguments.

Parameters
Return
Note

Watch out: the arguments really are in the order Y* then *X, which is a little counter-intuitive.

Examples

atan2(1, 1) // PI / 4 atan2(-1, 1) // -PI / 4 atan2(1, -1) // 3 * PI / 4 atan2(-1, -1) // -3 * PI / 4