COG Verb - VectorDist

Finds the difference between two vectors and returns its length. Syntax:

 diff_len=VectorDist(vector1, vector2); 

The Math

 diff_len=sqrt(sqr(x1-x2) + sqr(y1-y2) + sqr(z1-z2)); 

Geometrical Application

Image:Vectordist.gif

When one vector is subtracted from another, the resultant vector becomes a line from the tip of one vector to the other. The length of this line is the distance between the vectors.

Image:Vectordist2.gif

VectorDist() uses the displacement of the vector from '0 0 0' to measure the distance between vector1 and vector2. The operation is the same with positions; the difference is how you think of a position as opposed to a displacement vector.

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