目录

atan2()

该方法将直角坐标(x,y)转换为极坐标(r,theta)并返回theta。

语法 (Syntax)

double atan2(double y, double x)

参数 (Parameters)

  • X - X以双数据类型进行坐标
  • Y - Y在双数据类型中坐标

返回值 (Return Value)

此方法从极坐标(r,theta)返回theta。

例子 (Example)

以下是此方法的使用示例 -

class Example {     
   static void main(String[] args){
      double x = 45.0;
      double y = 30.0;
      System.out.println( Math.atan2(x, y) );
   } 
}

当我们运行上述程序时,我们将得到以下结果 -

0.982793723247329
↑回到顶部↑
WIKI教程 @2018