00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef __CP4D_H
00025 #define __CP4D_H
00026
00027
00028
00029
00031
00032 #include <iostream.h>
00033
00034
00036
00037
00038
00040
00041
00042
00047 class CP4D {
00048 public:
00049 static double epsilon;
00050
00053 CP4D() { m_ard[0] = 0.0;
00054 m_ard[1] = 0.0;
00055 m_ard[2] = 0.0;
00056 m_ard[3] = 0.0; };
00057
00060 CP4D(double rdX, double rdY, double rdZ) { m_ard[0] = rdX;
00061 m_ard[1] = rdY;
00062 m_ard[2] = rdZ;
00063 m_ard[3] = 1; };
00064
00067 CP4D(double rdX, double rdY, double rdZ, double rdW) { m_ard[0] = rdX;
00068 m_ard[1] = rdY;
00069 m_ard[2] = rdZ;
00070 m_ard[3] = rdW; };
00071
00074 CP4D(const CP4D& Point) { m_ard[0] = Point[0];
00075 m_ard[1] = Point[1];
00076 m_ard[2] = Point[2];
00077 m_ard[3] = Point[3]; };
00078
00079
00080
00082
00084
00087 operator CP3D() const;
00088
00090 const CP4D& operator=(const CP4D&);
00091
00096 int operator==(const CP4D&);
00097
00101 int operator!=(const CP4D&);
00102
00104 CP4D& operator+=(const CV4D&);
00105
00107 CP4D& operator-=(const CV4D&);
00108
00110 CV4D operator-(const CP4D&) const;
00111
00113 CP4D operator+(const CV4D&) const;
00114
00116 CP4D operator-(const CV4D&) const;
00117
00119 CP4D operator-() const;
00120
00124 double& operator[](int i) { return m_ard[i]; };
00125
00127 double operator[](int i) const { return m_ard[i]; };
00128
00129
00130
00132
00134
00138 CV4D getCV4D() const;
00139
00141 double getX() const { return m_ard[0]; };
00142
00144 double getY() const { return m_ard[1]; };
00145
00147 double getZ() const { return m_ard[2]; };
00148
00150 double getW() const { return m_ard[3]; };
00151
00153 void setX(double rdX) { m_ard[0] = rdX; };
00154
00156 void setY(double rdY) { m_ard[1] = rdY; };
00157
00159 void setZ(double rdZ) { m_ard[2] = rdZ; };
00160
00162 void setW(double rdW) { m_ard[3] = rdW; };
00163
00166 void setCoord(double rdX, double rdY, double rdZ, double rdW) { m_ard[0] = rdX;
00167 m_ard[1] = rdY;
00168 m_ard[2] = rdZ;
00169 m_ard[3] = rdW;
00170 return; };
00171
00173 void print() const;
00174
00175
00176
00178
00180
00182 friend ostream& operator<<(ostream&, const CP4D&);
00183
00185 friend istream& operator>>(istream&, CP4D&);
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00197 friend inline CP4D AffinComb3(double, const CP4D&,
00198 double, const CP4D&,
00199 double, const CP4D&);
00200
00201
00202 private:
00203 friend class CP3D;
00204
00205 protected:
00206 double m_ard[4];
00207 };
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217 inline const CP4D& CP4D::operator=(const CP4D& cPoint) {
00218
00219 m_ard[0] = cPoint.m_ard[0];
00220 m_ard[1] = cPoint.m_ard[1];
00221 m_ard[2] = cPoint.m_ard[2];
00222 m_ard[3] = cPoint.m_ard[3];
00223
00224 return *this;
00225 }
00226
00227
00228
00229
00230
00231
00232
00233 inline CV4D CP4D::getCV4D() const
00234
00235 {
00236 return CV4D(m_ard[0], m_ard[1], m_ard[2], m_ard[3]);
00237 }
00238
00239
00240
00241
00242
00243
00244
00245
00246 inline CP4D AffinComb3(double r, const CP4D& R, double s, const CP4D& S,
00247 double t, const CP4D &T)
00248
00249 {
00250 return CP4D(r*R[0] + s*S[0] + t*T[0],
00251 r*R[1] + s*S[1] + t*T[1],
00252 r*R[2] + s*S[2] + t*T[2],
00253 r*R[3] + s*S[3] + t*T[3]);
00254 }
00255
00256 #endif