java.lang.StrictMath.atan2()%uA0方法通过计算-pi的y/xin 范围内的圆弧相切的圆周率计算theta。它返回从直角坐标(x, y)为极坐标 (r, theta) 转化率的角度2%u3B8。
声明
以下是java.lang.StrictMath.atan2()方法的声明
public static double atan2(double y, double x)
参数
-
y%uA0-- 这是纵坐标。
-
x%uA0-- 这是横轴坐标。
返回值
此方法返回对应于直角坐标的点(x,y)到点(r, theta)在极坐标系中的%u3B8组成部分。
异常
-
NA
例子
下面的例子显示java.lang.StrictMath.atan2()方法的使用。
package com.yiibai import java.lang.* public class StrictMathDemo { public static void main(String[] args) { double d1 = 0.6 , d2 = 90.00 /* returns the theta component of the point (r, theta) in polar coordinates that corresponds to the point (x, y) in Cartesian coordinates */ double dAbsValue = StrictMath.atan2(d1, d2) System.out.println("arc tangent value after conversion = " + dAbsValue) dAbsValue = StrictMath.atan2(d2 , d1) System.out.println("arc tangent value after conversion = " + dAbsValue) } }
让我们来编译和运行上面的程序,这将产生以下结果:
arc tangent value after conversion = 0.0066665679038682285 arc tangent value after conversion = 1.5641297588910283