Provide the angle in radians corresponding to the polar coordinates derived from the given rectangular coordinates.
System. |
The atan2() function computes the angle theta in radians by converting rectangular coordinates (x, y) to polar coordinates (r, theta).
It’s equivalent to atan(y/x), but it accommodates negative x values, allowing for angles beyond the range of -π/2 to π/2.
Note: In the atan2() method, the y coordinate precedes the x coordinate, as it performs the division y / x. |
public static double atan2(double y, double x) |
Parameter |
Description |
y |
The input required is the y-coordinate of the point for which the angle is to be determined. |
x |
The input required is the x-coordinate of the point for which the angle is to be determined. |
Returns |
It returns a double value representing the angle in radians that a point (x, y) forms around the origin (0, 0). |
Java Version |
Any |