SIBCQuaternion.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 //***************************************************************************************
00013 // Includes
00014 //***************************************************************************************
00015 #include <float.h>
00016 #include <SIBCUtil.h>
00017 #include <SIBCMatrix.h>
00018 #include <SIBCVector.h>
00019 
00020 
00021 //***************************************************************************************
00022 // Defines
00023 //***************************************************************************************
00024 #ifndef __CSIBCQUATERNION_H__
00025 #define __CSIBCQUATERNION_H__
00026 
00027 //***************************************************************************************
00028 // CSIBCQuaternion | Implementation of a Quaternion class.
00029 //***************************************************************************************
00030 
00032 
00043 class XSICOREEXPORT CSIBCQuaternion
00044 {
00045     public:
00046         
00051         CSIBCQuaternion() :
00052             m_fW(1.0), m_fX(0.0), m_fY(0.0), m_fZ(0.0) {}
00053 
00060         CSIBCQuaternion(const CSIBCQuaternion &in_quat) { *this = in_quat; }  
00061 
00062         ~CSIBCQuaternion() {}
00063 
00075         inline SI_Error Init();
00076 
00088         SI_Error Init(CSIBCQuaternion &in_quat);
00089         
00104         SI_Error Init(SI_Float in_dX,
00105                       SI_Float in_dY, 
00106                       SI_Float in_dZ, 
00107                       SI_Float in_dW); 
00108 
00122         SI_Error Init(SI_Float in_dX, SI_Float in_dY, SI_Float in_dZ);
00123 
00131         SI_Float GetX() const { return m_fX; }
00132 
00140         SI_Float GetY() const { return m_fY; }
00141 
00149         SI_Float GetZ() const { return m_fZ; }
00150 
00158         SI_Float GetW() const { return m_fW; }
00159 
00174         inline SI_Error SetX(SI_Float in_dX);
00175 
00190         inline SI_Error SetY(SI_Float in_dY);
00191 
00206         inline SI_Error SetZ(SI_Float in_dZ);
00207 
00222         inline SI_Error SetW(SI_Float in_dW);
00223 
00237         SI_Error GetMatrix(CSIBCMatrix4x4 &out_mat);
00238 
00250         inline SI_Error GetXYZRotation(CSIBCVector3D &out_vect);
00251 
00266         SI_Error GetXYZRotation(SI_Float in_dX,
00267                                 SI_Float in_dY, 
00268                                 SI_Float in_dZ,
00269                                 CSIBCVector3D &out_vect);
00270 
00285         SI_Error GetAxisAngle(CSIBCVector3D &out_vAxis,
00286                               float &out_fAngle);
00287 
00304         inline SI_Error Set(SI_Float in_dX,
00305                             SI_Float in_dY,
00306                             SI_Float in_dZ,
00307                             SI_Float in_dW);
00308 
00313         inline void operator=(const CSIBCQuaternion &in_quat);
00314 
00323         inline SI_Error SelfTest();
00324 
00325     protected:
00326 
00327     private:
00328 
00329         // Attributes
00330         SI_Float m_fX, m_fY, m_fZ, m_fW;
00331 };
00332 
00333 
00334 #endif
00335 
00336 
00337