COG Verb - VectorSub

Subtracts the second vector from the first and returns the difference. Syntax:

 subvec=VectorSub(vector1, vector2); 

The Math

 subvec=(x1-x2, y1-y2, z1-z2) 

Geometrical Application

Image:Vectorsub.gif

Vector1 is the destination for the subvec and vector2 is the source. Subvec will have the length and direction to travel from the displacement of vector2 to the displacement of vector1.

The math for this operation is:

 '-2 2 0' - '1 3 0' = '-3 -1 0' 

A good use of VectorSub() is to find a lookvector (unnormalized) from one position to another.

  • Create:
This page was last modified 23:56, 2 April 2006.   This page has been accessed 233 times.