Java 教程
atan2() 方法用于將矩形坐標 (x, y) 轉(zhuǎn)換成極坐標 (r, theta),返回所得角 theta。該方法通過計算 y/x 的反正切值來計算相角 theta,范圍為從 -pi 到 pi。
double atan2(double y, double x)
y -- 縱坐標。
x -- 橫坐標。
與笛卡兒坐標中點 (x, y) 對應(yīng)的極坐標中點 (r, theta) 的 theta 組件。
編譯以上程序,輸出結(jié)果為:
0.982793723247329