atan2()atan2()

计算正 x 轴与从原点到点 (y, x) 的射线之间的角度(以弧度表示)。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)atan2(y,x)

参数Arguments

  • x:X 坐标(实数)。x : X coordinate (a real number).
  • y:Y 坐标(实数)。y : Y coordinate (a real number).

返回Returns

  • 正 x 轴与从原点到点 (y, x) 的射线之间的角度(以弧度表示)。The angle, in radians, between the positive x-axis and the ray from the origin to the point (y, x).

示例Examples

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)
atan2_0atan2_0 atan2_1atan2_1 atan2_2atan2_2
0.7853981633974480.785398163397448 3.141592653589793.14159265358979 -1.5707963267949-1.5707963267949