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
00032
00033
00034 #ifndef __CMAT4D_H_
00035 #define __CMAT4D_H_
00036
00037
00038
00040
00041
00042
00044 #if _MSC_VER >= 1200
00045 #include <iostream>
00046 #else
00047 #include <iostream.h>
00048 #endif
00049 #include <math.h>
00050 #include <string.h>
00051
00052
00053
00055 #include "CV4D.h"
00056 #include "CQuat.h"
00057 #include "CP4D.h"
00058
00059
00060
00062
00085 class CMat4D {
00086
00087 public:
00089 CMat4D(void);
00090
00094 CMat4D(const CV4D&, const CV4D&, const CV4D&, const CV4D&);
00095
00099 CMat4D(const double*);
00100
00102 CMat4D(double, double, double, double, double, double, double, double,
00103 double, double, double, double, double, double, double, double);
00104
00106 CMat4D(const CMat4D&);
00107
00109 static CMat4D PIdentity(void);
00110
00113 static CMat4D PTranslate(const CV4D&);
00114
00116 static CMat4D PTranslate(const CV3D&);
00117
00119 static CMat4D PTranslate(double, double, double);
00120
00123 static CMat4D PScale(const CV4D&);
00124
00126 static CMat4D PScale(const CV3D&);
00127
00129 static CMat4D PScale(double, double, double);
00130
00134 static CMat4D PRotate(const CV4D&, double);
00135
00138 static CMat4D PRotate(const CV3D&, double);
00139
00141 static CMat4D PRotate(CQuat&);
00142
00144 ~CMat4D(void);
00145
00146
00147
00149
00151
00153 const CMat4D& operator=(const CMat4D&);
00154
00156 const CMat4D& operator=(const double a);
00157
00159 CMat4D& operator+=(const CMat4D &m);
00160
00161
00162 CMat4D& operator-=(const CMat4D &m);
00163
00165 CMat4D& operator*=(const CMat4D&);
00166
00167
00169 CMat4D operator+(const CMat4D&) const;
00170
00172 CMat4D operator-(const CMat4D&) const;
00173
00175 CMat4D operator*(const CMat4D &m) const;
00176
00178 CMat4D operator*(double scalar) const;
00179
00181 bool operator == (const CMat4D &m) const;
00182
00184 bool operator != (const CMat4D &m) const;
00185
00186
00188 double operator()(int i,int j) const;
00189
00191 CV4D operator[](int i) const;
00192
00194 CV4D operator()(int j) const;
00195
00196
00198 friend CV4D operator*(const CMat4D&, const CV4D&);
00199
00201 friend CP4D operator*(const CMat4D&, const CP4D&);
00202
00204 friend CMat4D operator*(double, const CMat4D&);
00205
00207 friend CMat4D operator*(const CMat4D& M, double rdFactor) { return rdFactor*M; };
00208
00209
00210
00212
00214
00216 const double *getArray() { return m_ardValues; };
00217
00219 void clear(void);
00220
00224 void setValues(double* field);
00225
00227 double getCoeff(int i,int j) const;
00228
00230 void setCoeff(int i,int j, double value);
00231
00233 CMat4D getTransposed(void) const;
00234
00235
00236 CMat4D getInverted(void) const;
00237
00239 bool invert(void);
00240
00242 void transpose(void);
00243
00245 void print(void);
00246
00248 friend ::ostream& operator << (::ostream& s, const CMat4D &m );
00249
00251 void setIdentity( void );
00252
00254 CV4D getRow(int);
00255
00257 CV4D getCol(int);
00258
00260 void setRow(int nRow, const CV4D&);
00261
00263 void setCol(int nCol, const CV4D&);
00265 void setRows(const CV4D&, const CV4D&, const CV4D&, const CV4D&);
00266
00268 void setCols(const CV4D&, const CV4D&, const CV4D&, const CV4D&);
00269
00273 void setScaling(const CV4D&);
00274
00278 void setScaling(const CV3D&);
00279
00283 void setScaling(double, double, double);
00284
00288 void setTranslation(const CV4D&);
00289
00293 void setTranslation(const CV3D&);
00294
00298 void setTranslation(double, double, double);
00299
00301 void setRotation(CV4D&, double);
00302
00304 void setRotation(CV3D&, double);
00305
00307 void setRotation(CQuat&);
00308
00309
00310
00311 private:
00313 double* get1DField(void);
00314
00316 double** get2DField(void);
00317
00318 double m_ardValues[16];
00319 };
00320
00321 #endif // __CMAT4D_H_