Returns the arc tangent of a number whose angle is specified by drawing a vector from the origin (0,0) to a point whose coordinates are (x, y). The arc tangent is the angle whose tangent is the quotient, y/ x.
[Visual Basic] Public Shared Function Atan2( _ ByVal y As Double, _ ByVal x As Double _ ) As Double [C#] public static double Atan2( double y, double x ); [C++] public: static double Atan2( double y, double x ); [JScript] public static function Atan2( y : double, x : double ) : double;
Returns the angle theta such that- < q , and tan(q) = y/ x, where (x, y) is a point in the Cartesian plane. Observe that:
for (x, y) in Quadrant 1, we have 0 < q < /2
for (x, y) in Quadrant 2, we have /2 < q <
for (x, y) in Quadrant 3, we have- < q <-/2
for (x, y) in Quadrant 4, we have-/2 < q < 0
This method computes the angle q where tan(q) = y/ x. For example, if y and x are known, then the angle q is the value of atan2(y, x).