Math.atan2
Math.atan2
Function
Four-quadrant arctangent. Returns the bearing angle in radians based on y and x.
Syntax
Math.atan2(y, x)
Parameters
| Parameters | Type | Required | Default value | Description |
|---|---|---|---|---|
| y | Number | Yes | None | Vertical coordinate. |
| x | Number | Yes | None | The abscissa. |
Return value
| Type | Description |
|---|---|
| Int/Float | Returns the bearing angle in radians based on y and x. An Int is returned for integer results, and a Float for non-integer or non-finite results. |
Example
result = Math.atan2(0, 1) // Output: 0 print result
Notes
- The order of parameters is y first, x last.