Determine position of angle relative to another


Searching for this problem is not easy. Even though the solution is very, very short. I wouldn't say simple, but I'm fine with that.

So this problem is about having two angles (vectors) with the same origin. I needed to know whether one angle was left of right from the other, when looking at the acute angle (the shortest angle) between the two. The solution, brought on by @aadsm, is to get the cosine of them.


The result is either positive or negative, which indicates perfectly how the angles are positioned relative to each other. That's great! Because the best solution had come up with so far was about eight or ten different conditions for alpha and beta :p And still didn't work perfectly.

One of these days I'm gonna have to spend some more time figuring out how to get an intuitive feeling of what sin/cos/tan are/do and when to apply them. Ohwell.

Hope it helps you :)