Can someone please expplain to me what does Math.atan2 and Math.atan returns? I made a file to try to understand, but I cant figure out what they do!!!
I saw a lot o fo files wich use those actions, but still couldnt understand.
in trigonometry, tangent(tan) is the measure of the angle adjacent to the angle u want to find, over the angle opposite the angle u want to find. You use the Math.atan and atan2 to find this angle. you can use this to detect the mouse angle as well as other things i guess.
Math.atan returns an angle by a given Number (dy/dx).
Math.atan2 provides 2 parameters as dy, dx - where dx can be zero, which is not allowed to divide by in mathematic context.
Can someone please expplain to me what does Math.atan2 and Math.atan returns? I made a file to try to understand, but I cant figure out what they do!!!
I saw a lot o fo files wich use those actions, but still couldnt understand.
Math.atan2 returns the angle in radians of the resulting vector.
var radians:Number = Math.atan2(dy,dx);
var degrees:Number = radians * 180 / Math.PI;