Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

Mat44f.h

Go to the documentation of this file.
00001 // Copyright NVIDIA Corporation 2002-2004
00002 // TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED
00003 // *AS IS* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS
00004 // OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
00005 // AND FITNESS FOR A PARTICULAR PURPOSE.  IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS
00006 // BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES
00007 // WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
00008 // BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS)
00009 // ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS
00010 // BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES 
00011 
00012 #pragma once
00013 
00015 #include "nvsgcommon.h"
00016 
00017 #include "nvmath/Mat33f.h"
00018 #include "nvmath/Vec4f.h"
00019 
00020 namespace nvmath
00021 {
00023 
00026   class Mat44f : public Matnnf<4>
00027   {
00028     public:
00030 
00031       NVSG_API Mat44f( void );
00032 
00034 
00035       NVSG_API Mat44f( float a00, float a01, float a02, float a03
00036                      , float a10, float a11, float a12, float a13
00037                      , float a20, float a21, float a22, float a23
00038                      , float a30, float a31, float a32, float a33 );
00039 
00041 
00042       NVSG_API Mat44f( const Vec4f &row0    
00043                      , const Vec4f &row1    
00044                      , const Vec4f &row2    
00045                      , const Vec4f &row3    
00046                      ); 
00047 
00049 
00050       NVSG_API Mat44f( const Vec3f &trans                               
00051                      , const Quatf &rot                                 
00052                      );
00053 
00054 
00056       NVSG_API Mat44f( const Matnnf<4> & m );
00057 
00059       NVSG_API void set( const Vec4f &row0    
00060                        , const Vec4f &row1    
00061                        , const Vec4f &row2    
00062                        , const Vec4f &row3    
00063                        );
00064   };
00065 
00066   // - - - - -  - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
00067   // non-member functions
00068   // - - - - -  - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
00071   inline  void  decompose( const Mat44f &mat    
00072                          , Vec3f &scaling       
00073                          , Vec3f &shearing      
00074                          , Quatf &orientation   
00075                          , Vec3f &translation   
00076                          )
00077   {
00078     Mat33f  m33( mat[0][0], mat[0][1], mat[0][2],
00079                  mat[1][0], mat[1][1], mat[1][2],
00080                  mat[2][0], mat[2][1], mat[2][2] );
00081     decompose( m33, scaling, shearing, orientation );
00082     translation = Vec3f( mat[0][3], mat[1][3], mat[2][3] );
00083   }
00084 
00088   NVSG_API Mat44f operator*( const Mat44f &m0, const Mat44f &m1 );
00089 
00090   // - - - - -  - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
00091   // inlines
00092   // - - - - -  - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
00093   inline Mat44f::Mat44f( void )
00094   {
00095   };
00096 
00097   inline Mat44f::Mat44f( float a00, float a01, float a02, float a03
00098                        , float a10, float a11, float a12, float a13
00099                        , float a20, float a21, float a22, float a23
00100                        , float a30, float a31, float a32, float a33 )
00101   {
00102     (*this)[0][0] = a00;
00103     (*this)[0][1] = a01;
00104     (*this)[0][2] = a02;
00105     (*this)[0][3] = a03;
00106     (*this)[1][0] = a10;
00107     (*this)[1][1] = a11;
00108     (*this)[1][2] = a12;
00109     (*this)[1][3] = a13;
00110     (*this)[2][0] = a20;
00111     (*this)[2][1] = a21;
00112     (*this)[2][2] = a22;
00113     (*this)[2][3] = a23;
00114     (*this)[3][0] = a30;
00115     (*this)[3][1] = a31;
00116     (*this)[3][2] = a32;
00117     (*this)[3][3] = a33;
00118   }
00119 
00120   inline Mat44f::Mat44f( const Vec4f &row0, const Vec4f &row1, const Vec4f &row2, const Vec4f &row3 )
00121   {
00122     set( row0, row1, row2, row3 );
00123   }
00124 
00125   inline Mat44f::Mat44f( const Vec3f &trans, const Quatf &ori )
00126   {
00127     Mat33f  m( ori );
00128     (*this)[0] = Vec4f( m[0], trans[0] );
00129     (*this)[1] = Vec4f( m[1], trans[1] );
00130     (*this)[2] = Vec4f( m[2], trans[2] );
00131     (*this)[3] = Vec4f( 0.0f, 0.0f, 0.0f, 1.0f );
00132   }
00133 
00134   inline Mat44f::Mat44f( const Matnnf<4> &m )
00135     : Matnnf<4>( m )
00136   {
00137   }
00138 
00139   inline void Mat44f::set( const Vec4f &row0, const Vec4f &row1, const Vec4f &row2, const Vec4f &row3 )
00140   {
00141     (*this)[0] = row0;
00142     (*this)[1] = row1;
00143     (*this)[2] = row2;
00144     (*this)[3] = row3;
00145   }
00146 
00148   extern NVSG_API const Mat44f  cIdentity44f;
00149 
00150 } // end namspace nvmath

Generated on Tue Mar 1 13:19:20 2005 for NVSGSDK by NVIDIA