/*************************************************************************************** ***** CLASS POINT HEADER ***** **************************************************************************************** ** Author: Peter Stuart ** Email: chester@selway.umt.edu ** Date: 3/7/98 ** Description: This class implements a point in 3-space. Operations include all the ** necessary conversions from points to vectors, along with basic operators ** ** NOTE: The matrices, vectors, and points use homogeneous coordinates ** ***************************************************************************************/ #include #include "Vector.hpp" #ifndef __GGPOINT__ #define __GGPOINT__ #ifndef FALSE #define FALSE 0 #endif #ifndef TRUE #define TRUE !FALSE #endif class Point { private: /* Private Variables: _x: x coordinate _y: y coordinate _z: z coordinate */ double _x; double _y; double _z; public: //Constructor, Copy Constructor, and Destructor Point(const double x = 0.0, const double y = 0.0, const double z = 0.0); Point(const Point&); virtual ~Point(); // Assignment operator, arithmetic operators, relational operators, and output stream Point& operator = (const Point&); friend Point operator + (const Point&, const Vector&); friend Point operator + (const Vector&, const Point&); friend Point operator - (const Point&); friend Vector operator - (const Point&, const Point&); friend Point operator - (const Point&, const Vector&); friend Point operator * (const Point&, const double); friend Point operator * (const double, const Point&); friend Point operator / (const Point&, const double); friend Point operator / (const double, const Point&); friend int operator == (const Point&, const Point&); friend int operator != (const Point&, const Point&); friend ostream& operator << (ostream&, const Point&); // variable access double x() const { return _x; }; double y() const { return _y; }; double z() const { return _z; }; void x(const double xin) { _x = xin; }; void y(const double yin) { _y = yin; }; void z(const double zin) { _z = zin; }; }; // common point declarations const Point zeroPoint (0.0, 0.0, 0.0); const Point xPoint (1.0, 0.0, 0.0); const Point yPoint (0.0, 1.0, 0.0); const Point zPoint (0.0, 0.0, 1.0); #endif