Atan2

Description

The atan2 function is a variation of the atan function. For a given coordinates (x, y), atan2(y, x) is the angle between the positive X axis and the point (x, y). The angle is positive for counter-clockwise angles (where y > 0), and negative for clockwise angles (where y < 0). The result angle range is (-\pi , \pi ], and for both x and y are zeroes, atan2(0, 0) = 0.

Returned values are in radians, degrees or gradians, depending upon the system.math.angularunits object property (which can also be set in the Options dialog box).

Syntax

double Atan2(double y, double x)

Parameters

y

The y value of coordinate (x, y).

x

The x value of coordinate (x, y).

Return

Return the angle between the positive X axis and the point given by the coordinates (x, y).

Example

atan2(4, 3) = ;  // 0.92729521800161
atan2(0, -1) = ;  // 3.1415926535898
atan2(0, 0) = ;  // 0
atan2(-1, -1) = ;  // -2.3561944901923

See Also

Angle, Atan