The C++ AffPoint Class

Overview

Instances of class AffPoint encapsulate the notion of 3D points in an affine space:

Definition: An n-dimensional affine space consists of a set of points, an associated n-dimensional vector space, and two operations: subtraction of two points in the set and addition of a point in the set and a vector in the associated vector space. The former produces a vector in the associated vector space, and the latter produces another point in the affine space. Unlike a vector space, which has the distinguished vector 0, an affine space does not include a distinguished point.

The methods specified here provide an implementation of these and other operations.

Points and vector operations lie at the heart of many common operations in computer graphics and geometric modeling. Since OpenGL is a common API used when visualizing such models, the descriptions below point out how to best make certain common connections between OpenGL and objects defined in terms of points and vectors. You should also review the Point, Vector, Matrix Utilities page to see more extensive examples of interfaces to OpenGL.

You may also wish to review the definition of an n-dimensional vector space.

Caveats

Just because a C++ expression involving instances of the AffPoint class is syntactically valid from the perspective of the compiler does not imply that it is semantically valid. That is, it may or may not be well-defined. Be sure you read and understand the relevant concepts as described in the references (especially the discussion beginning in the middle of column 1 on the fifth page of reference #1).

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 the midpoint of two points P and Q can be accomplished as:
AffPoint Mid = 0.5 * (P + Q);

Don't forget the "caution" note above. Recall that many of these operators are defined here for convenience and are not individually meaningful. It is up to the user of these tools to make sure that the overall expression is valid. The midpoint operation immediately preceding this paragraph uses invalid operations, for example. Using only the operations defined for points and vectors in affine spaces, we should have computed the midpoint as:

AffPoint Mid = P + 0.5*(Q - P);

Allowing these and similar liberties for individual operations is often convenient. Multiplication of a point by a scalar, adding points, and similar invalid operations are defined below simply because using them is oftentimes the most convenient, clear, and even computationally efficient way to compute desired quantities. The price for this convenience, however, is that care must be taken to ensure that quantities ultimately computed for subsequent use are meaningful.

In the following, assume that instances of AffPoint called P, Q, R, and S have been declared and initialized. Similarly, we will assume that an instance of AffVector called v has been declared.

AffPoint Instance Methods

AffPoint Public Constants

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

AffPoint Class Methods


Jim Miller