SIBCRotMatd.h

00001 //***************************************************************************************
00002 //
00003 // File supervisor: Softimage 3D Games & 3D Bridge team
00004 //
00005 // (c) Copyright 1999-2002 Avid Technology, Inc. . All rights reserved.
00006 //
00007 // SIBCRotMatd.h | Main header file for SIBCRotMatd implementation
00008 //***************************************************************************************
00009 
00010 /****************************************************************************************
00011 THIS CODE IS PUBLISHED AS A SAMPLE ONLY AND IS PROVIDED "AS IS".
00012 IN NO EVENT SHALL SOFTIMAGE, AVID TECHNOLOGY, INC. AND/OR THEIR RESPECTIVE
00013 SUPPLIERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
00014 DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
00015 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
00016 CONNECTION WITH THE USE OR PERFORMANCE OF THIS CODE .
00017 
00018 COPYRIGHT NOTICE. Copyright © 1999-2002 Avid Technology Inc. . All rights reserved. 
00019 
00020 SOFTIMAGE is a registered trademark of Avid Technology Inc. or its subsidiaries 
00021 or divisions. Windows NT is a registered trademark of Microsoft Corp. All other
00022 trademarks contained herein are the property of their respective owners. 
00023 ****************************************************************************************/
00024 
00025 #if (_MSC_VER > 1000) || defined(SGI_COMPILER)
00026 #pragma once
00027 #endif
00028 
00029 //******************************************************************************
00030 // Defines
00031 //******************************************************************************
00032 
00033 #ifndef _ROTMAT_H_
00034 #define _ROTMAT_H_
00035 
00036 //******************************************************************************
00037 // Includes
00038 //******************************************************************************
00039 
00040 #include "SIBCMathLib.h"
00041 
00042 //******************************************************************************
00043 // CSIBCRotMatd | 3X3 rotation matrix.
00044 //******************************************************************************
00045 
00047 
00063 class XSICOREEXPORT CSIBCRotMatd : private CSIBCMatrix33d
00064 {
00065     // Public members
00066     public:
00067         //****************************************
00068         // Constructors/Destructor
00069         //****************************************
00070 
00076         CSIBCRotMatd( void );
00077 
00090         CSIBCRotMatd(   const CSIBCVector3Dd& in_vct0,
00091                         const CSIBCVector3Dd& in_vct1,
00092                         const CSIBCVector3Dd& in_vct2,
00093                         const bool in_bAreRows = true );
00094 
00110         CSIBCRotMatd( 
00111             const double in_dA00, const double in_dA01, const double in_dA02, 
00112             const double in_dA10, const double in_dA11, const double in_dA12, 
00113             const double in_dA20, const double in_dA21, const double in_dA22 );
00114 
00115         // Destructor.
00116         ~CSIBCRotMatd();
00117 
00118         //****************************************
00119         // General access functions:
00120         //****************************************
00121 
00128         double Get( const int in_nRow, const int in_nCol ) const;
00129 
00130         //****************************************
00131         // Matrix element modification functions:
00132         //****************************************
00133 
00143         CSIBCRotMatd& Set( int in_nRow, int in_nCol, const double in_dVal );
00144 
00154         CSIBCRotMatd& Set( double in_dVal[3][3] );
00155 
00164         CSIBCRotMatd& Set( const CSIBCMatrix33d& in_mat );
00165 
00174         CSIBCRotMatd& Set( const CSIBCRotMatd& in_mat );
00175 
00176         // @member Set  | Set rotation from one of the main axes
00177         //                  (X, Y or Z) and an angle.
00184         CSIBCRotMatd& Set( const E3DAxisType in_axis, const double in_dAngle );
00185 
00195         CSIBCRotMatd& SetRow( const int in_nRow, const CSIBCVector3Dd& in_vct );
00196 
00207         CSIBCRotMatd& SetRow( const int in_nRow, double in_dA0, double in_dA1, double in_dA2 );
00208 
00218         CSIBCRotMatd& SetCol( const int in_nCol, const CSIBCVector3Dd& in_vct );
00219 
00230         CSIBCRotMatd& SetCol( const int in_nCol, double in_dA0, double in_dA1, double in_dA2 );
00231 
00237         CSIBCRotMatd& SetNull();
00238 
00244         CSIBCRotMatd& SetIdentity( void );
00245 
00246 
00247         //****************************************
00248         // Matrix comparison functions:
00249         //****************************************
00250 
00261         friend bool AreAlmostEqual( const CSIBCRotMatd& in_mat1,
00262                                 const CSIBCRotMatd& in_mat2,
00263                                 const double in_dEpsilon = PICO_EPS );
00264 
00265 
00273         bool operator ==( const CSIBCMatrix33d & in_mat ) const;
00274 
00282         bool operator !=( const CSIBCMatrix33d & in_mat ) const;
00283 
00284         //****************************************
00285         // Matrix algebra functions:
00286         //****************************************
00287 
00298         CSIBCRotMatd& Mul( const CSIBCRotMatd& in_mat1, const CSIBCRotMatd& in_mat2 );
00299 
00309         CSIBCRotMatd& Mul( const CSIBCRotMatd& in_mat );
00310 
00321         CSIBCRotMatd& MulTransByReg( const CSIBCRotMatd& in_mat1,
00322                                    const CSIBCRotMatd& in_mat2 );
00323 
00334         CSIBCRotMatd& MulRegByTrans( const CSIBCRotMatd& in_mat1,
00335                                    const CSIBCRotMatd& in_mat2 );
00336 
00343         CSIBCRotMatd& Negate( const CSIBCRotMatd& in_mat );
00344 
00350         CSIBCRotMatd& Negate();
00351 
00357         double GetDet( void ) const;
00358 
00363         double GetTrace( void ) const;
00364 
00372         CSIBCRotMatd& Transpose( const CSIBCRotMatd& in_mat );
00373 
00379         CSIBCRotMatd& Transpose( void );
00380 
00388         CSIBCRotMatd& Invert( const CSIBCRotMatd& in_mat );
00389 
00396         CSIBCRotMatd& Invert( void );
00397     
00398     // Protected members
00399     protected:
00400 
00401     // Private members
00402     private:
00403 
00404         // Disable copy constructor and operator =
00405         CSIBCRotMatd( const CSIBCRotMatd& in_mat );
00406         CSIBCRotMatd& operator =( const CSIBCRotMatd& in_mat );
00407 };
00408 
00409 
00410 #endif