In the AS3, the tangent atan2 function is more useful than the Atan function (that is, the side of the corner), which allows us to make the correct rotation of the object. Remember that the y axis coordinates in Flash are reversed in math. (as shown above), the flash is calculated in radians! The tick marks on the coordinates are not accurate, and you will probably move to the corresponding point. The following list values can be verified
Atan (Val:number) atan2 (Y:number,x:number)
Radian Angle Conversion formula:
radians to angle
degree = radians * 180/PI
Angle to radians
radians = degree * pi/180
When using the Atan function (note is an approximate value): [Radian]
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°
When using the ATAN2 function (note is an approximate value): [Radian]
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°