An understanding and correct use of vector techniques where appropriate can greatly simplify a number of geometric problems. As a very simple example consider the problem of finding the intersection of two lines in a plane. If the lines are handled in the form:
y1 = m1*x1 + b1
y2 = m2*x2 + b2
the problem can be solved but special cases must be handled when one,
or both, lines are vertical, that is, m1 and/or m2 are not defined.
The use of vector techniques completely avoids this problem, no direction
is any more special than another.
If a few fundamental tools are correctly built and tested then it
is not hard to write rock solid algorithms using them. This
document will start off giving a few such tools.
This document assumes that the JHU/APL/S1R IDL library is on your IDL path.
Vectors will be indicated by a bold letter: A.
Vector components: A = (Ax,Ay,Az).
For 2-d vectors the Z component does not exist (or is 0).
Points will be indicated by a non-bold letter: A.
Point positions are ordered triples (or pairs for 2-d): (Ax,Ay,Az).
The relation between points and vectors: consider points to
be locations in space. Consider vectors to have a magnitude and
direction. A vector may or may not be tied to a specific point
in space.
Vectors between points: Two points in space, A=(Ax,Ay,Az),
and B=(Bx,By,Bz) may be considered to define a vector. The vector,
V from A to B is V = (Bx-Ax,By-Ay,Bz-Az).
Position vectors: The position vector of a point A is simply
the vector from the origin O = (0,0,0) to point A = (Ax,Ay,Az).
The position vector of point A is A = (Ax-0,Ay-0,Az-0)
= (Ax,Ay,Az).
Vector addition: C = A + B
Product of a scalar and a vector: a*A = (a*Ax, a*Ay, a*Az)
Vector subtraction: A - B = A + -1*B
Dot Product: A dot B
Cross Product: A x B
Parallel component: A_par
Perpendicular component: A_perp
Length of a vector: |A| = sqrt(Ax^2 + Ay^2 + Az^2)
Unit vector: A_hat where |A_hat| is 1.
Surface Normal: A vector perpendicular to a surface at a point
on the surface.
Index to this document