Java atan2() 方法

Java 教程 · 2019-02-08 15:42:42

atan2() 方法用于将矩形坐标 (x, y) 转换成极坐标 (r, theta),返回所得角 theta。该方法通过计算 y/x 的反正切值来计算相角 theta,范围为从 -pi 到 pi。

语法

double atan2(double y, double x)

参数

  • y -- 纵坐标。

  • x -- 横坐标。

返回值

与笛卡儿坐标中点 (x, y) 对应的极坐标中点 (r, theta) 的 theta 组件。

实例

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

编译以上程序,输出结果为:

0.982793723247329

点击查看所有 Java 教程 文章: https://codercto.com/courses/l/12.html

查看所有标签

Algorithms for Image Processing and Computer Vision

Algorithms for Image Processing and Computer Vision

Parker, J. R. / 2010-12 / 687.00元

A cookbook of algorithms for common image processing applications Thanks to advances in computer hardware and software, algorithms have been developed that support sophisticated image processing with......一起来看看 《Algorithms for Image Processing and Computer Vision》 这本书的介绍吧!

在线进制转换器
在线进制转换器

各进制数互转换器

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码