Applies to: Math Object
The atan2 method is use to get the angle (in radians) from the X axis to a point (y,x).
Syntax
Math.atan2(y, x)
The atan2 method syntax has these parts:
Part |
Description |
Math |
Required. Invokes the intrinsic Math object. |
x |
Required. A numeric expression representing the cartesian x-coordinate. |
y |
Required. A numeric expression representing the cartesian y-coordinate. |
Return value
Returns the angle (in radians) from the X axis to a point (y,x).
Example
The return value is between -pi and pi, representing the angle of the supplied (y,x) point.
See also: atan Method, Math Object Methods, tan Method |