SIBCQuaternion.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 // SIBCQuaternion.h | Main header file for SIBCQuaternion 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 //***************************************************************************************
00026 // Includes
00027 //***************************************************************************************
00028 #include <float.h>
00029 #include <SIBCUtil.h>
00030 #include <SIBCMatrix.h>
00031 #include <SIBCVector.h>
00032 
00033 
00034 //***************************************************************************************
00035 // Defines
00036 //***************************************************************************************
00037 #ifndef __CSIBCQUATERNION_H__
00038 #define __CSIBCQUATERNION_H__
00039 
00040 //***************************************************************************************
00041 // CSIBCQuaternion | Implementation of a Quaternion class.
00042 //***************************************************************************************
00043 
00045 
00056 class XSICOREEXPORT CSIBCQuaternion
00057 {
00058     public:
00059         
00064         CSIBCQuaternion() :
00065             m_fW(1.0), m_fX(0.0), m_fY(0.0), m_fZ(0.0) {}
00066 
00073         CSIBCQuaternion(const CSIBCQuaternion &in_quat) { *this = in_quat; }  
00074 
00075         ~CSIBCQuaternion() {}
00076 
00088         inline SI_Error Init();
00089 
00101         SI_Error Init(CSIBCQuaternion &in_quat);
00102         
00117         SI_Error Init(SI_Float in_dX,
00118                       SI_Float in_dY, 
00119                       SI_Float in_dZ, 
00120                       SI_Float in_dW); 
00121 
00135         SI_Error Init(SI_Float in_dX, SI_Float in_dY, SI_Float in_dZ);
00136 
00144         SI_Float GetX() const { return m_fX; }
00145 
00153         SI_Float GetY() const { return m_fY; }
00154 
00162         SI_Float GetZ() const { return m_fZ; }
00163 
00171         SI_Float GetW() const { return m_fW; }
00172 
00187         inline SI_Error SetX(SI_Float in_dX);
00188 
00203         inline SI_Error SetY(SI_Float in_dY);
00204 
00219         inline SI_Error SetZ(SI_Float in_dZ);
00220 
00235         inline SI_Error SetW(SI_Float in_dW);
00236 
00250         SI_Error GetMatrix(CSIBCMatrix4x4 &out_mat);
00251 
00263         inline SI_Error GetXYZRotation(CSIBCVector3D &out_vect);
00264 
00279         SI_Error GetXYZRotation(SI_Float in_dX,
00280                                 SI_Float in_dY, 
00281                                 SI_Float in_dZ,
00282                                 CSIBCVector3D &out_vect);
00283 
00298         SI_Error GetAxisAngle(CSIBCVector3D &out_vAxis,
00299                               float &out_fAngle);
00300 
00317         inline SI_Error Set(SI_Float in_dX,
00318                             SI_Float in_dY,
00319                             SI_Float in_dZ,
00320                             SI_Float in_dW);
00321 
00326         inline void operator=(const CSIBCQuaternion &in_quat);
00327 
00336         inline SI_Error SelfTest();
00337 
00338     protected:
00339 
00340     private:
00341 
00342         // Attributes
00343         SI_Float m_fX, m_fY, m_fZ, m_fW;
00344 };
00345 
00346 
00347 #endif
00348 
00349 
00350