Atan2
%Atan2 function
Function
Inverse tangent function with two arguments. Returns the angle, in degrees, determined by the coordinates of the point (x, y), in the range from -180 to 180. The result is a real value. The result is similar to %ArcTan(y/x), but %Atan2 also accepts the case where x = 0. For the input x = 0, y = 0, the function returns INVALID.
Declaration
REAL %Atan2(
REAL in y
REAL in x
)Parameters
y | Y-coordinate of the point. |
x | X-coordinate of the point. |
Example
_angle := %Atan2(1, 1) ; 45.0
_angle := %Atan2(0, 1) ; 0.0
_angle := %Atan2(1, 0) ; 90.0
_angle := %Atan2(-1, 0) ; -90.0
_angle := %Atan2(-%Sqrt(3), -1) ; -120.0
_angle := %Atan2(0, 0) ; INVALIDRelated pages: