00001 00002 00003 00004 00005 // ChangeLog is at the implementation file 00006 00007 #ifndef __VPVPPOINT4D_H 00008 #define __VPVPPOINT4D_H 00009 00010 #include "vppoint.h" 00011 #include "vppoint3d.h" // Temporarily needed. VPPoint3D could be replaced by VPPoint4D. 00012 #include "vpvertex3d.h" // Temporarily needed. VPVertex3D could be replaced by VPPoint4D. 00013 #include "vpvector3d.h" // Temporarily needed. VPVector3D could be replaced by VPPoint4D. 00014 #include <iostream> 00015 00026 class VPPoint4D : public VPPoint 00027 { 00029 // FixMe: Perhaps this will cause trouble on an application with no console... 00030 friend std::ostream& operator<<(std::ostream& output, const VPPoint4D& p); 00031 00033 typedef bool (VPPoint4D::*tCompareOper)(const VPPoint4D&) const; 00034 public: 00035 // PUBLIC METHODS 00037 VPPoint4D(); 00038 VPPoint4D(const VPPoint4D& point); 00039 VPPoint4D(const VPVertex3D& v); 00040 VPPoint4D(const VPVector3D& v); 00041 VPPoint4D(const VPPoint3D& p); 00042 VPPoint4D(double x, double y, double z, double w = 1.0); 00043 00044 VPPoint4D operator-() const; 00045 bool operator==(const VPPoint4D& point) const; 00046 bool operator!=(const VPPoint4D& point) const; 00047 void operator=(const VPPoint4D& point); 00048 void operator=(const VPVertex3D& v); 00049 void operator=(const VPVector3D& v); 00050 void operator=(const VPPoint3D& p); 00051 00053 00056 bool operator<(const VPPoint4D& p) const; 00057 00060 bool LexicographicalLess(const VPPoint4D& p) const; 00061 00064 bool XThenZLess(const VPPoint4D& p) const; 00066 00069 VPPoint4D operator+(const VPPoint4D& vector) const; 00070 void operator+=(const VPPoint4D& vector); 00071 00073 00076 VPPoint4D operator-(const VPPoint4D& point) const; 00077 VPPoint4D operator*(double escalar) const; 00078 void operator*=(double escalar); 00079 00080 double GetX() const { return vetCoord[0]; } 00081 double GetY() const { return vetCoord[1]; } 00082 double GetZ() const { return vetCoord[2]; } 00083 double GetW() const { return vetCoord[3]; } 00084 00086 00088 const double* VetXYZW() const { return vetCoord; } 00089 00091 double DotProduct(const VPPoint4D& p) const; 00092 00094 00097 double AngleTo(const VPPoint4D& p) const; 00098 00100 VPPoint4D CrossProduct(const VPPoint4D& p) const; 00101 00102 void SetX(double x) { vetCoord[0] = x; } 00103 void SetY(double y) { vetCoord[1] = y; } 00104 void SetZ(double z) { vetCoord[2] = z; } 00105 void SetW(double w) { vetCoord[3] = w; } 00106 void SetXYZW(double x, double y, double z, double w); 00107 00109 00114 void Normalize(); 00115 double Length() const; 00116 // CLASS CONSTANT INITIALIZERS 00118 static const VPPoint4D& DOWN(); 00120 static const VPPoint4D& ORIGIN(); 00122 static const VPPoint4D& X(); 00124 static const VPPoint4D& Y(); 00126 static const VPPoint4D& Z(); 00127 // PUBLIC ATTRIBUTES 00129 00134 static tCompareOper operatorLess; 00135 private: 00136 double vetCoord[4]; 00137 }; 00138 00139 #endif