The C++ AffVector Class

Overview

Instances of class AffVector encapsulate the notion of 3D geometric vectors. Such geometric vectors are an example of the more general mathematical notion of vector spaces:

Definition: An n-dimensional vector space consists of a set of vectors and two operations: addition and scalar multiplication. The vector space is closed under these two operations: addition of two vectors yields a vector in the vector space; multiplication of a vector by a scalar also produces a vector in the vector space. Finally, there exists a distinguished member of the set called the zero vector 0 with the properties that a* 0 = 0 for all scalars a, and 0 + v = v + 0 = v for all vectors v.

The methods specified here provide an implementation of these and other operations (cross products, dot products, etc.). Also included are methods involving instances of class AffPoint. This class encapsulates the notion of points in an n-dimensional affine space.

Caveats

While every attempt is made to keep these html pages current as new releases of the utilities are made available, there is no guarantee that all operations in a given release will be documented here. While all the fundamental operations are, look around the header files for additional methods that may have been added but not yet documented here.

Constructors

C++ Overloaded Operators

The operators specified here allow derived vector algebraic expressions to be directly translated into code. For example, computing a vector bisector of two vectors u and v can be accomplished as:
AffVector b = 0.5 * (u + v);

In the following, assume that instances of AffVector called u, v, w, and n have been declared and initialized.

AffVector Instance Methods

AffVector Public Constants

The following constants are AffVector class variables that can be used in your programs.

AffVector Class Methods

The following class methods are available. Notice that cross and dot methods are defined both as instance methods (see above) and as class methods here. Being available as a class method in addition to an instance method provides flexibility to the programmer. Class methods can be passed as parameters, for example to be used as callback functions in an ANSI C program. Alternatively, if a product involving arithmetic combinations of vectors is desired, the class method can be used instead of creating a new vector. For example:

AffVector myVec = AffVector::cross( u+v , w+n );