SIBCRotMatd.h

00001 //***************************************************************************************
00002 //
00003 // File supervisor: Crosswalk team
00004 //
00005 // Copyright 2008 Autodesk, Inc.  All rights reserved.  
00006 // Use of this software is subject to the terms of the Autodesk license agreement 
00007 // provided at the time of installation or download, or which otherwise accompanies 
00008 // this software in either electronic or hard copy form.
00009 //
00010 //***************************************************************************************
00011 
00012 #if (_MSC_VER > 1000) || defined(SGI_COMPILER)
00013 #pragma once
00014 #endif
00015 
00016 //******************************************************************************
00017 // Defines
00018 //******************************************************************************
00019 
00020 #ifndef _ROTMAT_H_
00021 #define _ROTMAT_H_
00022 
00023 //******************************************************************************
00024 // Includes
00025 //******************************************************************************
00026 
00027 #include "SIBCMathLib.h"
00028 
00029 //******************************************************************************
00030 // CSIBCRotMatd | 3X3 rotation matrix.
00031 //******************************************************************************
00032 
00034 
00050 class XSICOREEXPORT CSIBCRotMatd : private CSIBCMatrix33d
00051 {
00052     // Public members
00053     public:
00054         //****************************************
00055         // Constructors/Destructor
00056         //****************************************
00057 
00063         CSIBCRotMatd( void );
00064 
00077         CSIBCRotMatd(   const CSIBCVector3Dd& in_vct0,
00078                         const CSIBCVector3Dd& in_vct1,
00079                         const CSIBCVector3Dd& in_vct2,
00080                         const bool in_bAreRows = true );
00081 
00097         CSIBCRotMatd( 
00098             const double in_dA00, const double in_dA01, const double in_dA02, 
00099             const double in_dA10, const double in_dA11, const double in_dA12, 
00100             const double in_dA20, const double in_dA21, const double in_dA22 );
00101 
00102         // Destructor.
00103         ~CSIBCRotMatd();
00104 
00105         //****************************************
00106         // General access functions:
00107         //****************************************
00108 
00115         double Get( const int in_nRow, const int in_nCol ) const;
00116 
00117         //****************************************
00118         // Matrix element modification functions:
00119         //****************************************
00120 
00130         CSIBCRotMatd& Set( int in_nRow, int in_nCol, const double in_dVal );
00131 
00141         CSIBCRotMatd& Set( double in_dVal[3][3] );
00142 
00151         CSIBCRotMatd& Set( const CSIBCMatrix33d& in_mat );
00152 
00161         CSIBCRotMatd& Set( const CSIBCRotMatd& in_mat );
00162 
00163         // @member Set  | Set rotation from one of the main axes
00164         //                  (X, Y or Z) and an angle.
00171         CSIBCRotMatd& Set( const E3DAxisType in_axis, const double in_dAngle );
00172 
00182         CSIBCRotMatd& SetRow( const int in_nRow, const CSIBCVector3Dd& in_vct );
00183 
00194         CSIBCRotMatd& SetRow( const int in_nRow, double in_dA0, double in_dA1, double in_dA2 );
00195 
00205         CSIBCRotMatd& SetCol( const int in_nCol, const CSIBCVector3Dd& in_vct );
00206 
00217         CSIBCRotMatd& SetCol( const int in_nCol, double in_dA0, double in_dA1, double in_dA2 );
00218 
00224         CSIBCRotMatd& SetNull();
00225 
00231         CSIBCRotMatd& SetIdentity( void );
00232 
00233 
00234         //****************************************
00235         // Matrix comparison functions:
00236         //****************************************
00237 
00248         friend bool AreAlmostEqual( const CSIBCRotMatd& in_mat1,
00249                                 const CSIBCRotMatd& in_mat2,
00250                                 const double in_dEpsilon = PICO_EPS );
00251 
00252 
00260         bool operator ==( const CSIBCMatrix33d & in_mat ) const;
00261 
00269         bool operator !=( const CSIBCMatrix33d & in_mat ) const;
00270 
00271         //****************************************
00272         // Matrix algebra functions:
00273         //****************************************
00274 
00285         CSIBCRotMatd& Mul( const CSIBCRotMatd& in_mat1, const CSIBCRotMatd& in_mat2 );
00286 
00296         CSIBCRotMatd& Mul( const CSIBCRotMatd& in_mat );
00297 
00308         CSIBCRotMatd& MulTransByReg( const CSIBCRotMatd& in_mat1,
00309                                    const CSIBCRotMatd& in_mat2 );
00310 
00321         CSIBCRotMatd& MulRegByTrans( const CSIBCRotMatd& in_mat1,
00322                                    const CSIBCRotMatd& in_mat2 );
00323 
00330         CSIBCRotMatd& Negate( const CSIBCRotMatd& in_mat );
00331 
00337         CSIBCRotMatd& Negate();
00338 
00344         double GetDet( void ) const;
00345 
00350         double GetTrace( void ) const;
00351 
00359         CSIBCRotMatd& Transpose( const CSIBCRotMatd& in_mat );
00360 
00366         CSIBCRotMatd& Transpose( void );
00367 
00375         CSIBCRotMatd& Invert( const CSIBCRotMatd& in_mat );
00376 
00383         CSIBCRotMatd& Invert( void );
00384     
00385     // Protected members
00386     protected:
00387 
00388     // Private members
00389     private:
00390 
00391         // Disable copy constructor and operator =
00392         CSIBCRotMatd( const CSIBCRotMatd& in_mat );
00393         CSIBCRotMatd& operator =( const CSIBCRotMatd& in_mat );
00394 };
00395 
00396 
00397 #endif