What is the best way of getting clockwise angle of 2 points?
So if I have two points p1 and p2 and I want to get their clockwise angle.
So for example, if I had two points one at 10,10 and the other at 15, 15 I needed to get the angle that is 45.
If I have 10,10 and 10, 15. I would need 0. etc.
So the first point is my center and I need to get the angle of the second point compared to a vector that goes straight north.
I have already tried:
Code:
double getAngleBetween(point p1, point p2){
double angle = atan2(p1.y, p1.x) - atan2(p2.y, p2.x);
angle = angle*360/PI;
if(angle<0){
angle+=360;
}
return angle;
}
NOTE: point is a struct I defined, it just contains x and y values
But this does not give me the results that I need.
Thanks! :)