/*************************************************************************************** ***** CLASS FRAME HEADER ***** **************************************************************************************** ** Author: Peter Stuart ** Date: 3/7/98 ** Description: This class represents a coordinate frame. The frame is made up of three ** orthogonal vectors u, v, w, and origin point o. Methods include finding the ** matrix to trasform coordinates from frame space to cartesian space, changing ** orientation and position in both frame and cartesian coordinates, and the ** standard relational, assignment, and output stream methods. ** ** Note: All of these graphics classes use a right-handed coordinate system. ** ***************************************************************************************/ #include #include "Vector.hpp" #include "Point.hpp" #include "Matrix4D.hpp" #ifndef __GGFRAME__ #define __GGFRAME__ #ifndef FALSE #define FALSE 0 #endif #ifndef TRUE #define TRUE !FALSE #endif class Frame { private: /* Private Variables: _u: vector corresponding to the frame's x axis _v: vector corresponding to the frame's y axis _w: vector corresponding to the frame's z axis _o: point representing the frame's origin */ Vector _u, _v, _w; Point _o; public: // Constructors, Copy Constructor, and Destructor Frame (const Vector& u = xVector, const Vector& v = yVector, const Vector& w = zVector, const Point& p = zeroPoint); Frame (const Frame&); virtual ~Frame (void); // Assignment operator, relational operators, and output stream Frame& operator = (const Frame&); friend int operator == (const Frame&, const Frame&); friend int operator != (const Frame&, const Frame&); friend ostream& operator << (ostream&, const Frame&); // operations to change frame's orientation void transformFrame (const Matrix4D&); void translateFrame (const double&, const double&, const double&); void rotateFrame (const double&, const double&, const double&); // coordinate transformation matrices Matrix4D cartTransform(void); Matrix4D frameTransform(void); // variable access Vector u (void) const { return _u; }; Vector v (void) const { return _v; }; Vector w (void) const { return _w; }; Point o (void) const { return _o; }; void u (const Vector& vec) { _u = vec; }; void v (const Vector& vec) { _v = vec; }; void w (const Vector& vec) { _w = vec; }; void o (const Point& pt) { _o = pt; }; }; // common Frame declartation const Frame cartFrame; #endif