The Point data type together with the Vector data type, implements an affine space in 3-dimensions. The arithmetic operations interact with those of the Vector class corresponding to the axioms of an affine space. That is,
- A Vector can be added to a Point, giving a Point
- Two Points can be subtracted, giving a Vector
- Affine combinations of Points can be taken, giving another Point.
Note: If one does not understand the workings of and affine space, then some of the error messages generated by C++ may be difficult to understand.
One makes a Vector from a Point by subtracting the constant Point PointZero. That isVector v ; Point p ; . v = p - PointZero ; // OK, subtracting two points // gives a Vector v = p ; // Compiler ErrorWhereas this structure may seem difficult to comprehend to the novice user, it is utilized to separate the operations of Points and Vectors in the C++ implementation of an affine space.
To Obtain the Class
To obtain the Point class you need both the include file Point.h and the source code file Point.C.
The user must also include the Vector class for the Point class to operate correctly.
Make Sure to Also Include...
Be sure to include the following lines in your source code file, as these routines utilize them.#include <stdlib.h> #include <math.h> #include <stream.h> #include <strings.h>Also, if you wish to use UNIX commands (exevlp, system, sleep, etc.) in your program, you should also have#include <unistd.h>
Note the capitalization of the letter P in the class name. This avoid name conflicts with other systems (like gl) that uses the typename ``point''.
This class was generated for a research system at UC Davis and has worked in a variety of situations. Unfortunately, this is not a guarantee that it will work in your situation. You may use it ``as is'' or can modify it. If you find errors, and can correct them, please send mail to the address below, as we would also like to know about them.
This document maintained by Ken Joy.
Comments to the author : firstname.lastname@example.org
All contents copyright (c) 1998
Computer Science Department, University of California, Davis
All rights reserved.