Vector

by Joe Strout

This is a very simple-but-handy implementation of a three-dimensional real-valued vector. (You can use it as a 2D vector, too; the third (Z) dimension defaults to zero.) No source code (.cxx) file is needed; it's an entirely inline class, which means that code using it will be very zippy (no true function calls).

Grab the header file here.

Vector supports all the arithmatic operators you would expect: addition and subtraction (+,-), multiplication by a scalar (*), and cross product (*). Other functions are:

Note: if you need the component of a vector A which is perpendicular to another vector B, it's just A - A.Proj(B)

http://www-ncmir.ucsd.edu/~jstrout/classlib/String.html
Last Updated: 1/30/96 Joe Strout ( joe@strout.net )