Notifications
Clear all
[Closed] Finding the angle between two vectors
Dec 01, 2014 2:11 pm
How do you calculate the angle between two vectors not starting from origin, like that, for example:
1 Reply
Dec 01, 2014 2:11 pm
What you drew is not two vectors, it’s two line segments.
A vector has only a direction and a length, which can be described as a line going from the origin to a point in space.
When someone describes a vector between two points, they mean the vector you get when you subtract one point from the other. So in essence, the whole issue of ‘starting from the origin’ does not exist.
In effect, your two vectors are:
v1 = [4,3] - [0,3] = [4,0]
v2 = [3,0] - [0,2] = [3,-2]
So now you can ask, how do I find the angle between these two vectors.
v1 = [4,0]
v2 = [3,-2]
nv1 = normalize v1
nv2 = normalize v2
dotProduct = nv1.x * nv2.x + nv1.y * nv2.y
acos dotProduct