Quote:Sorry, but I dont understand the distinction between a vector and a point. Isn't a point just a vector from <0, 0> ?I'm not going to try to answer the question from a rigorous mathematical perspective, but I will say that yes, in practice, points are often considered as displacements from the origin in the context of games and graphics programming.
Quote:I would have thought specifying points in 2D space would have made it obvious that I meant 2D vectors :)Not really. Whether you're using separate point and vectors classes or using a vector class to represent both vectors and points, it's still important to use correct terminology when talking about geometrical problems.
The phrase 'angle between two points' isn't self-explanatory (IMO, at least). I can think of at least two possible interpretations:
1. It's the angle between the vectors from the origin to each point that you're interested in.
2. It's the absolute angle of the vector from one point to the other that you're interested in.
The rest of your post makes it pretty clear that it's number 2 that you're after, in which case the 'atan2' solution suggested by shadowcomplex is probably the most straightforward solution.
The 'acos' method can be used to compute the unsigned relative angle between two vectors. With a little extra work it can be used to compute the signed angle as well, in which case you could solve the stated problem by finding the relative angle between the vector from A to B and the x axis.
However, it's more straightforward to use atan2 if you have it available. (Personally, I prefer to use atan2 for all 'angle between vectors' problems, as it eliminates the need for the input vectors to be unit-length, and sidesteps some numerical issues that have to be dealt with when using the 'acos' method.)