atan2()
Calculates the angle, in radians, between the positive x-axis and the ray from the origin to the point (y, x).
Syntax
atan2(
y,
x)
Parameters
Name | Type | Required | Description |
---|---|---|---|
y | real | ✓ | The Y coordinate. |
x | real | ✓ | The X coordinate. |
Returns
Returns the angle in radians between the positive x-axis and the ray from the origin to the point (y, x).
Examples
The following example returns the angle measurements in radians.
print atan2_0 = atan2(1,1) // Pi / 4 radians (45 degrees)
| extend atan2_1 = atan2(0,-1) // Pi radians (180 degrees)
| extend atan2_2 = atan2(-1,0) // - Pi / 2 radians (-90 degrees)
Results
atan2_0 | atan2_1 | atan2_2 |
---|---|---|
0.785398163397448 | 3.14159265358979 | -1.5707963267949 |