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 #ifndef CEYLAN_MATRIX_3_H_
00028 #define CEYLAN_MATRIX_3_H_
00029
00030
00031 #include "CeylanVector3.h"
00032 #include "CeylanMatrix.h"
00033 #include "CeylanLinear.h"
00034
00035 #include <string>
00036
00037
00038
00039 namespace Ceylan
00040 {
00041
00042
00043 namespace Maths
00044 {
00045
00046
00047 namespace Linear
00048 {
00049
00050
00051
00052
00053 class Tripoint ;
00054
00055
00056
00057 class Vector3 ;
00058
00059
00060
00075 class CEYLAN_DLL Matrix3: public Matrix
00076 {
00077
00078
00079
00080
00081
00083 friend class Tripoint ;
00084
00085
00087 friend class Vector3 ;
00088
00089
00090
00102 CEYLAN_DLL friend bool operator == ( const Matrix3 & m1,
00103 const Matrix3 & m2 ) ;
00104
00105
00106
00117 CEYLAN_DLL friend bool operator != ( const Matrix3 & m1,
00118 const Matrix3 & m2 ) ;
00119
00120
00121
00126 CEYLAN_DLL friend Matrix3 operator + ( const Matrix3 & m1,
00127 const Matrix3 & m2 ) ;
00128
00129
00130
00135 CEYLAN_DLL friend Matrix3 operator - ( const Matrix3 & m1,
00136 const Matrix3 & m2 ) ;
00137
00138
00139
00144 CEYLAN_DLL friend Matrix3 operator * ( const Matrix3 & m1,
00145 const Matrix3 & m2 ) ;
00146
00147
00148
00153 CEYLAN_DLL friend Matrix3 operator * ( Real lambda,
00154 const Matrix3 & m ) ;
00155
00156
00157
00165 CEYLAN_DLL friend Matrix3 operator ! ( const Matrix3 & m ) ;
00166
00167
00168
00174 CEYLAN_DLL friend Matrix3 operator ~ ( const Matrix3 & m ) ;
00175
00176
00177
00182 CEYLAN_DLL friend Vector3 operator * ( const Matrix3 & m ,
00183 const Vector3 & v ) ;
00184
00185
00186
00187
00188 public:
00189
00190
00198 explicit Matrix3(
00199 Real x0 = 0, Real x1 = 0, Real x2 = 0,
00200 Real y0 = 0, Real y1 = 0, Real y2 = 0,
00201 Real z0 = 0, Real z1 = 0, Real z2 = 0
00202 ) ;
00203
00204
00205
00214 Matrix3( const Matrix3 & source ) ;
00215
00216
00217
00219 virtual ~Matrix3() throw() ;
00220
00221
00222
00227 virtual void setTo(
00228 Real x0 = 0, Real x1 = 0, Real x2 = 0,
00229 Real y0 = 0, Real y1 = 0, Real y2 = 0,
00230 Real z0 = 0, Real z1 = 0, Real z2 = 0
00231 ) ;
00232
00233
00234
00242 virtual void setColumn( MatrixIndex columnNumber,
00243 const Vector3 & newColumn ) ;
00244
00245
00246
00252 virtual void setAllElementsTo( Real commonValue ) ;
00253
00254
00255
00265 virtual Real getElementAt( MatrixIndex abscissa,
00266 MatrixIndex ordinate ) const ;
00267
00268
00269
00279 virtual void setElementAt( MatrixIndex abscissa,
00280 MatrixIndex ordinate, Real newValue ) ;
00281
00282
00283
00285 virtual void setToIdentity() ;
00286
00287
00288
00294 virtual void setToDiagonal( Real diagonalTerm ) ;
00295
00296
00297
00299 virtual void transpose() ;
00300
00301
00302
00304 virtual Real trace() const ;
00305
00306
00307
00309 virtual Real determinant() const ;
00310
00311
00312
00325 virtual const std::string toString(
00326 VerbosityLevels level = high ) const ;
00327
00328
00329
00330
00331
00332
00333
00334
00336 static Matrix3 Cofactor( const Matrix3 & m ) ;
00337
00338
00339
00341 static Matrix3 Adjoint( const Matrix3 & m ) ;
00342
00343
00344
00356 template<typename T>
00357 static Matrix3 CreateFrom( T endomorphism )
00358 {
00359
00360 Matrix3 result ;
00361
00362 Vector3 v( 1, 0, 0 ) ;
00363 v = endomorphism( v ) ;
00364 result.setColumn( 0, v ) ;
00365
00366 v.setTo( 0 ,1 ,0 ) ;
00367 v = endomorphism( v ) ;
00368 result.setColumn( 1, v ) ;
00369
00370 v.setTo( 0, 0, 1 ) ;
00371 v = endomorphism( v ) ;
00372 result.setColumn( 2, v ) ;
00373
00374 return result ;
00375
00376 }
00377
00378
00379
00384 static const MatrixIndex Dimensions = 3 ;
00385
00386
00387
00388 protected:
00389
00390
00392 Real _mat[Dimensions][Dimensions] ;
00393
00394
00395
00396 } ;
00397
00398
00399
00400
00401
00402
00403
00404
00405 CEYLAN_DLL Matrix3 operator ! ( const Matrix3 & m ) ;
00406
00407
00408 }
00409
00410 }
00411
00412 }
00413
00414
00415
00416 #endif // CEYLAN_MATRIX_3_H_
00417