AS3 atan与atan2函数区别
AS3里,反正切atan2函数比反正切atan函数(即角的对边比邻边)更为有用,它可以让我们做出对物体正确的旋转.请记住Flash里的y轴 坐标与数学的是颠倒的.(上面演示所示),Flash是以弧度来计算的!坐标上的刻度值位置不太准,没校对大家就大概移到相应的点的位置上就可以验证狼蚁网站SEO优化 的列表值
atan(val:Number) atan2(y:Number,x:Number)
弧度角度换算公式:
弧度转为角度
degree = radians * 180 / PI
角度转为弧度
radians = degree * PI / 180
当用atan函数时(注意是近似值):[弧度\度]
Math.atan(1/2)≈0.4636476090008061≈26.56505117707799°
Math.atan(-1/2)≈-0.4636476090008061≈-26.56505117707799°
Math.atan(-1/-2)≈0.4636476090008061≈26.56505117707799°
Math.atan(1/-2)≈-0.4636476090008061≈-26.56505117707799°
当用atan2函数时(注意是近似值):[弧度\度]
Math.atan2(1,2)≈0.4636476090008061≈26.56505117707799°
Math.atan2(-1,2)≈-0.4636476090008061≈-26.56505117707799°
Math.atan2(-1,-2)≈-2.677945044588987≈-153.43494882292202°
Math.atan2(1,-2)≈2.677945044588987≈153.43494882292202°