xtd 0.2.0
Loading...
Searching...
No Matches

◆ atan2()

static double xtd::math::atan2 ( double  y,
double  x 
)
static

Returns the angle whose tangent is the specified number.

Parameters
yThe y coordinate of a point.
xThe x coordinate of a point.
Returns
An angle, A, measured in radians, such that -PI <= A <= PI, and tan(?) = y / x, where (x, y) is a point in the Cartesian plane.

Observe the following:

  • For (x, y) in quadrant 1, 0 < A < PI/2.
  • For (x, y) in quadrant 2, PI/2 < A <= PI.
  • For (x, y) in quadrant 3, -PI < A < -PI/2.
  • For (x, y) in quadrant 4, -PI/2 < A < 0.
  • For points on the boundaries of the quadrants, the return value is the following:
  • If x is 0 and y is not negative, A = 0.
  • If x is 0 and y is negative, A = PI.
  • If x is positive and y is 0, A = PI/2.
  • If x is negative and y is 0, A = -PI/2.
    Remarks
    The return value is the angle in the Cartesian plane formed by the x-axis, and a vector starting from the origin, (0,0), and terminating at the point, (x,y).