At 4/7/09 12:59 AM, Kwing wrote:
At 4/6/09 10:51 PM, Nano256 wrote:
At 4/6/09 09:49 PM, Kwing wrote:
So if:
myRadians=Math.atan2(_y,_x);
and let's say x is 5 and y is 10, then what is myRadians? I'm trying to figure out what exactly it does.
Here's a really quick sketch of what that will give you in visual terms.
Really, really cool! But... How does 60 degrees convert to an obscure decimal?
Radians and degrees are two different ways of measuring angles.
180 degrees is equal to Pi radians (3.141592653...).
Hence, if you were to convert 60 degrees to radians, you would divide by 180 and multiply by Pi.
60 / 180 * Pi = 1.047197551...
Which is not the same radian I showed in my graphic. I made a mathematical mistake, in the graphic, the radians are correct, however that translates to 63.4349.
Simply, stick this in flash:
trace(Math.atan2(10, 5))
And that outputs 1.1071487177940904
If you divide that by Pi, and multiply by 180 degrees...
trace(Math.atan2(10,5) / Math.PI * 180)
That outputs 63.43494882292201, which is what that translates to degrees.