JavaScript Math.atan2() 函数
Math.atan2(y,x) -- 返回由x轴到点(x,y)的角度(以弧度为单位)
- atan是arc tangent缩写
- 引用网址:http://www.dreamdu.com/javascript/Math.atan2/
atan2函数语法
Math.atan2(y,x);
atan2函数参数
atan2函数返回值
返回x轴到点(x,y)的角度,此值在-π(PI)与π(PI)之间的弧度
atan2函数示例
document.write(Math.atan2(5,0));document.write(Math.atan2(0,5));
结果:
1.5707963267948966 0