JAVA朗,数学。Java中的atan2()

atan2() 是Java中的一个内置方法,用于从极坐标返回θ分量。atan2()方法返回一个介于- pi  pi  代表角度 	heta  (x,y)点和正x轴的。它是正X轴和点(X,y)之间的逆时针角度,以弧度为单位。 语法:

null
Math.atan2(double y, double x)where, x and y are X and Y coordinates in double data type.

返回: 它返回一个双精度值。双值是 	heta  从极坐标(r,θ)。 例子: 演示atan2()方法的程序

JAVA

// Java program for implementation of
// atan2() method
import java.util.*;
class GFG {
// Driver Code
public static void main(String args[])
{
// X and Y coordinates
double x = 90.0 ;
double y = 15.0 ;
// theta value from polar coordinate (r, theta)
double theta = Math.atan2(y, x);
System.out.println(theta);
}
}


输出

0.16514867741462683

© 版权声明
THE END
喜欢就支持一下吧
点赞8 分享