PDA

View Full Version : Direction and vector



giuseppe500
09-30-2011, 07:42 AM
hello.
I'm a beginner.
How i can calculate the direction vector if I have two point A and B?
I'm in a tree dimensional space with opengl then A={1,1,0} and B={2,2,1} for example.
Is sufficent do B - A ? or is different A - B?
The direction is a 3d vector?
Thanks.

BionicBytes
09-30-2011, 08:35 AM
To obtain a direction, calculate A-B, then normalise the result.
The sign(s) of the resultant direction vector is really telling you if your direction is A-->B or B-->A.

ZbuffeR
09-30-2011, 08:39 AM
It depends if you go from A to B or from B to A :)

A to B is B-A

Depending on the case, direction vector must be normalized, but not sure it applies to your case.