We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi, as in the image: I have 2 points. the red one in the center is fixed. the green one is rotating around the red one. How can I determine the angle 'a' (blue) between them in the range 0° - 360° ?
http://www2.zippyshare.com/v/WLwOIo3o/file.html
thank you!
Answers
??? If you're drawing it at a certain angle, surely you must know the angle!
Of course, if you don't know where the point is...
atan2() will get you the two angles (angle from horizon in radians, origin at the red ball). then take one away from the other to get the angle between the two.
see wikipedia.
thank you, I checked atan2 but didn't really understood it..subtracting each other works!
I was needing an angle between function and looked up this old discussion.
I had a very hard time understanding it but this is what I came up with, in case anyone needs it.
I hope my code is ok.
The crucial point was
d
from 2 vectorsa
and mouse position (those I wanted the angle between) and do atan2 on d to get an angle andBest, Chrisir ;-)