Calculating angle from two co-ordinates
Given x1,y1 and x2,y2, how do you work out the angle of x2,y2 from x1,y1?
Thanks for any help!
First off, an angle is something you have between two directions, not between two points.
However, I assume that you want the angle between the direction of the x-axis and the direction between the points. This is easy, if you program in c/c++ or similiar there is a function called atan2() which takes the difference in y as its first parameter and the difference in x as its second. It returns the angle in radians (between -pi and pi) (1 radian=180/pi degrees).
However, I assume that you want the angle between the direction of the x-axis and the direction between the points. This is easy, if you program in c/c++ or similiar there is a function called atan2() which takes the difference in y as its first parameter and the difference in x as its second. It returns the angle in radians (between -pi and pi) (1 radian=180/pi degrees).
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement