00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #ifndef __CP4D_H
00032 #define __CP4D_H
00033
00034
00035
00036
00038
00039 #include <iostream.h>
00040
00041
00043
00044
00045
00047
00048
00049
00054 class CP4D {
00055 public:
00056 static double epsilon;
00057
00060 CP4D() { m_ard[0] = 0.0;
00061 m_ard[1] = 0.0;
00062 m_ard[2] = 0.0;
00063 m_ard[3] = 0.0; };
00064
00067 CP4D(double rdX, double rdY, double rdZ) { m_ard[0] = rdX;
00068 m_ard[1] = rdY;
00069 m_ard[2] = rdZ;
00070 m_ard[3] = 1; };
00071
00074 CP4D(double rdX, double rdY, double rdZ, double rdW) { m_ard[0] = rdX;
00075 m_ard[1] = rdY;
00076 m_ard[2] = rdZ;
00077 m_ard[3] = rdW; };
00078
00081 CP4D(const CP4D& Point) { m_ard[0] = Point[0];
00082 m_ard[1] = Point[1];
00083 m_ard[2] = Point[2];
00084 m_ard[3] = Point[3]; };
00085
00086
00087
00089
00091
00094 operator CP3D() const;
00095
00097 const CP4D& operator=(const CP4D&);
00098
00103 int operator==(const CP4D&);
00104
00108 int operator!=(const CP4D&);
00109
00111 CP4D& operator+=(const CV4D&);
00112
00114 CP4D& operator-=(const CV4D&);
00115
00117 CV4D operator-(const CP4D&) const;
00118
00120 CP4D operator+(const CV4D&) const;
00121
00123 CP4D operator-(const CV4D&) const;
00124
00126 CP4D operator-() const;
00127
00131 double& operator[](int i) { return m_ard[i]; };
00132
00134 double operator[](int i) const { return m_ard[i]; };
00135
00136
00137
00139
00141
00145 CV4D getCV4D() const;
00146
00148 double getX() const { return m_ard[0]; };
00149
00151 double getY() const { return m_ard[1]; };
00152
00154 double getZ() const { return m_ard[2]; };
00155
00157 double getW() const { return m_ard[3]; };
00158
00160 void setX(double rdX) { m_ard[0] = rdX; };
00161
00163 void setY(double rdY) { m_ard[1] = rdY; };
00164
00166 void setZ(double rdZ) { m_ard[2] = rdZ; };
00167
00169 void setW(double rdW) { m_ard[3] = rdW; };
00170
00173 void setCoord(double rdX, double rdY, double rdZ, double rdW) { m_ard[0] = rdX;
00174 m_ard[1] = rdY;
00175 m_ard[2] = rdZ;
00176 m_ard[3] = rdW;
00177 return; };
00178
00180 void print() const;
00181
00182
00183
00185
00187
00189 friend ostream& operator<<(ostream&, const CP4D&);
00190
00192 friend istream& operator>>(istream&, CP4D&);
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00204 friend inline CP4D AffinComb3(double, const CP4D&,
00205 double, const CP4D&,
00206 double, const CP4D&);
00207
00208
00209 private:
00210 friend class CP3D;
00211
00212 protected:
00213 double m_ard[4];
00214 };
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224 inline const CP4D& CP4D::operator=(const CP4D& cPoint) {
00225
00226 m_ard[0] = cPoint.m_ard[0];
00227 m_ard[1] = cPoint.m_ard[1];
00228 m_ard[2] = cPoint.m_ard[2];
00229 m_ard[3] = cPoint.m_ard[3];
00230
00231 return *this;
00232 }
00233
00234
00235
00236
00237
00238
00239
00240 inline CV4D CP4D::getCV4D() const
00241
00242 {
00243 return CV4D(m_ard[0], m_ard[1], m_ard[2], m_ard[3]);
00244 }
00245
00246
00247
00248
00249
00250
00251
00252
00253 inline CP4D AffinComb3(double r, const CP4D& R, double s, const CP4D& S,
00254 double t, const CP4D &T)
00255
00256 {
00257 return CP4D(r*R[0] + s*S[0] + t*T[0],
00258 r*R[1] + s*S[1] + t*T[1],
00259 r*R[2] + s*S[2] + t*T[2],
00260 r*R[3] + s*S[3] + t*T[3]);
00261 }
00262
00263 #endif