Udostępnij za pośrednictwem


StrictMath.Atan2(Double, Double) Method

Definition

Returns the angle theta from the conversion of rectangular coordinates (x, y) to polar coordinates (r, theta).

[Android.Runtime.Register("atan2", "(DD)D", "")]
public static double Atan2 (double y, double x);
[<Android.Runtime.Register("atan2", "(DD)D", "")>]
static member Atan2 : double * double -> double

Parameters

y
Double

the ordinate coordinate

x
Double

the abscissa coordinate

Returns

the theta component of the point (r,&nbsp;theta) in polar coordinates that corresponds to the point (x,&nbsp;y) in Cartesian coordinates.

Attributes

Remarks

Returns the angle theta from the conversion of rectangular coordinates (x,&nbsp;y) to polar coordinates (r,&nbsp;theta). This method computes the phase theta by computing an arc tangent of y/x in the range of -pi to pi. Special cases: <ul><li>If either argument is NaN, then the result is NaN. <li>If the first argument is positive zero and the second argument is positive, or the first argument is positive and finite and the second argument is positive infinity, then the result is positive zero. <li>If the first argument is negative zero and the second argument is positive, or the first argument is negative and finite and the second argument is positive infinity, then the result is negative zero. <li>If the first argument is positive zero and the second argument is negative, or the first argument is positive and finite and the second argument is negative infinity, then the result is the double value closest to pi. <li>If the first argument is negative zero and the second argument is negative, or the first argument is negative and finite and the second argument is negative infinity, then the result is the double value closest to -pi. <li>If the first argument is positive and the second argument is positive zero or negative zero, or the first argument is positive infinity and the second argument is finite, then the result is the double value closest to pi/2. <li>If the first argument is negative and the second argument is positive zero or negative zero, or the first argument is negative infinity and the second argument is finite, then the result is the double value closest to -pi/2. <li>If both arguments are positive infinity, then the result is the double value closest to pi/4. <li>If the first argument is positive infinity and the second argument is negative infinity, then the result is the double value closest to 3*pi/4. <li>If the first argument is negative infinity and the second argument is positive infinity, then the result is the double value closest to -pi/4. <li>If both arguments are negative infinity, then the result is the double value closest to -3*pi/4.</ul>

Java documentation for java.lang.StrictMath.atan2(double, double).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to