Angle AND "direction" from vector to point
by Nicolas Stohler · in Technical Issues · 05/31/2006 (5:28 am) · 1 replies
I need to determine the following in 2d space (for TGB):
I have a point A with vector V (or the angle pointing into direction of V) and a point B.
Imagine you are standing at point A looking into direction of vector V.
Now I want to calculate
1) in which DIRECTION I have to start turning to see B as soon as possible (< 180 degrees)
and
2) how much degrees I have to turn.
I have a point A with vector V (or the angle pointing into direction of V) and a point B.
Imagine you are standing at point A looking into direction of vector V.
Now I want to calculate
1) in which DIRECTION I have to start turning to see B as soon as possible (< 180 degrees)
and
2) how much degrees I have to turn.
Torque 3D Owner Eric Roberts
e.g.
VectorF posVec = B - A;
And you would calculate ONLY the z-component of the cross product. The reason why I say this is because you will get a negative or positive result depending on which side each of the vectors on. The result really depends on the coordinate system so you need to check which is which (I'm not certain for TGB).
You can calculate degrees by understanding the Dot Product of two vectors (the same two I mentioned above).
Wikipedia / Google could probably explain it better - give it a search.
- Eric