Reputation: 8607
In this ActionScript reference on the atan2
function, it reads:
Computes and returns the angle of the point y/x in radians, when measured counterclockwise from a circle's x axis (where 0,0 represents the center of the circle). The return value is between positive pi and negative pi. Note that the first parameter to atan2 is always the y coordinate.
For example
Math.atan2(0.7071, -0.7071)
(note that the first parameter is the Y coordinate) returns 2.356, which is positive Pi*3/4.
But in Flash graphics the Y axis goes down, not up. Shouldn't it be "clockwise" instead?
Upvotes: 2
Views: 1572
Reputation: 25972
This is the general description of what the atan2 function does in all programming languages.
With that said, you have to indeed put atan(-dy,dx) to get the counter-clock wise angle in screen coordinates, or atan2(dx,dy) to get the zero angle pointing upwards.
Upvotes: 6