The mathAtan2() function returns the angle in the plane (in radians) between the positive x-axis and the ray from (0,0) to the point (x,y).
mathAtan2()
0.12.0
The y coordinate
The x coordinate
The arctangent of the quotient of the arguments
mathAtan2(1, 1); // 0.7853981633974483 (approximately π/4)mathAtan2(1, 0); // 1.5707963267948966 (π/2)mathAtan2(0, 1); // 0mathAtan2(-1, -1); // -2.356194490192345 (approximately -3π/4) Copy
mathAtan2(1, 1); // 0.7853981633974483 (approximately π/4)mathAtan2(1, 0); // 1.5707963267948966 (π/2)mathAtan2(0, 1); // 0mathAtan2(-1, -1); // -2.356194490192345 (approximately -3π/4)
Returns the angle (in radians) from the X axis to a point.
A numeric expression representing the cartesian y-coordinate.
A numeric expression representing the cartesian x-coordinate.
The
mathAtan2()
function returns the angle in the plane (in radians) between the positive x-axis and the ray from (0,0) to the point (x,y).Since
0.12.0
Param: y
The y coordinate
Param: x
The x coordinate
Returns
The arctangent of the quotient of the arguments
Example