fbxtransforms.h

Go to the documentation of this file.
00001 /****************************************************************************************
00002  
00003    Copyright (C) 2013 Autodesk, Inc.
00004    All rights reserved.
00005  
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 
00013 #ifndef _FBXSDK_CORE_MATH_TRANSFORMS_H_
00014 #define _FBXSDK_CORE_MATH_TRANSFORMS_H_
00015 
00016 #include <fbxsdk/fbxsdk_def.h>
00017 
00018 #include <fbxsdk/core/math/fbxmath.h>
00019 #include <fbxsdk/core/math/fbxquaternion.h>
00020 
00021 #include <fbxsdk/fbxsdk_nsbegin.h>
00022 
00034 class FBXSDK_DLL FbxLimits
00035 {
00036 public:
00038     FbxLimits();
00039 
00041     FbxLimits& operator=(const FbxLimits& pLimits);
00042 
00046     bool GetActive() const;
00047 
00051     void SetActive(const bool pActive);
00052 
00056     bool GetMinXActive() const;
00057 
00061     bool GetMinYActive() const;
00062 
00066     bool GetMinZActive() const;
00067 
00073     void GetMinActive(bool& pXActive, bool& pYActive, bool& pZActive) const;
00074 
00078     FbxDouble3 GetMin() const;
00079 
00083     void SetMinXActive(const bool pActive);
00084 
00088     void SetMinYActive(const bool pActive);
00089 
00093     void SetMinZActive(const bool pActive);
00094 
00100     void SetMinActive(const bool pXActive, const bool pYActive, const bool pZActive);
00101 
00105     void SetMin(const FbxDouble3& pMin);
00106 
00110     bool GetMaxXActive() const;
00111 
00115     bool GetMaxYActive() const;
00116 
00120     bool GetMaxZActive() const;
00121 
00127     void GetMaxActive(bool& pXActive, bool& pYActive, bool& pZActive) const;
00128 
00132     FbxDouble3 GetMax() const;
00133 
00137     void SetMaxXActive(const bool pActive);
00138 
00142     void SetMaxYActive(const bool pActive);
00143 
00147     void SetMaxZActive(const bool pActive);
00148 
00154     void SetMaxActive(const bool pXActive, const bool pYActive, const bool pZActive);
00155 
00159     void SetMax(const FbxDouble3& pMax);
00160 
00165     bool GetAnyMinMaxActive() const;
00166     
00170     FbxDouble3 Apply(const FbxDouble3& pVector);
00171 
00172 /*****************************************************************************************************************************
00173 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
00174 *****************************************************************************************************************************/
00175 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00176 private:
00177     enum EMask {eActive=1<<0, eMinX=1<<1, eMinY=1<<2, eMinZ=1<<3, eMaxX=1<<4, eMaxY=1<<5, eMaxZ=1<<6, eAll=eMinX|eMinY|eMinZ|eMaxX|eMaxY|eMaxZ};
00178 
00179     FbxUInt8    mMask;
00180     FbxDouble3  mMin;
00181     FbxDouble3  mMax;
00182 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
00183 };
00184 
00185 class FBXSDK_DLL FbxRotationOrder
00186 {
00187 public: 
00188     FbxRotationOrder(int pOrder=FbxEuler::eOrderXYZ);
00189 
00190     int     GetOrder();
00191     void    SetOrder(int pOrder);
00192     void    V2M(FbxAMatrix& pRM, const FbxVector4& pV);
00193     void    M2V(FbxVector4& pV, FbxAMatrix& pRM);
00194     bool    V2VRef(FbxVector4& pVOut, FbxVector4& pVIn, FbxVector4& pVRef);
00195 
00196 private:
00197     int     mOrder;
00198 };
00199 
00202 class FBXSDK_DLL FbxTransform
00203 {
00204 public:
00205     enum EInheritType {eInheritRrSs, eInheritRSrs, eInheritRrs};
00206 
00207     FbxTransform();
00208 
00209     EInheritType        GetInheritType();
00210     void                SetInheritType(EInheritType pType);
00211     FbxLimits&          GetTranslationLimits();
00212     FbxLimits&          GetRotationLimits();
00213     FbxLimits&          GetScalingLimits();
00214     FbxRotationOrder&   GetRotationOrder();
00215     bool                HasROffset();
00216     bool                HasRPivot();
00217     bool                HasSOffset();
00218     bool                HasSPivot();
00219     bool                HasPreRM();
00220     bool                HasPostRM();
00221     void                SetROffset(FbxVector4& pROffset);
00222     void                SetRPivot(FbxVector4& pRPivot);
00223     void                SetSOffset(FbxVector4& pSOffset);
00224     void                SetSPivot(FbxVector4& pSPivot);
00225     void                SetPreRM(FbxVector4& pPreR);
00226     void                SetPostRM(FbxVector4& pPostR);
00227     bool                GetRotationSpaceForLimitOnly();
00228     void                SetRotationSpaceForLimitOnly(bool pRotationSpaceForLimitOnly);
00229 
00230     void                DoF2LT(FbxVector4& pLT, FbxVector4& pDoF, FbxAMatrix& pLRM, FbxAMatrix& pLSM);
00231     void                LT2DoF(FbxVector4& pDoF, FbxVector4 pLT, FbxAMatrix& pLRM, FbxAMatrix& pLSM);
00232     void                DoF2LRM(FbxAMatrix& pLRM, FbxVector4& pRDoF, bool pForLimit=false);
00233     void                LRM2DoF(FbxVector4& pRDoF, FbxAMatrix& pLRM, bool pForLimit=false);
00234     void                LSM2GSM(FbxAMatrix& pGSM, FbxAMatrix& pPGSM, FbxAMatrix& pLSM, FbxAMatrix& pLRM, FbxVector4& pPLS);
00235     void                GTRSM2GX(FbxAMatrix& pGX, FbxVector4& pGT, FbxAMatrix& pGRM, FbxAMatrix& pGSM);
00236 
00237 private:
00238     void                SumPivots(FbxVector4& pSum, FbxAMatrix& pLRM, FbxAMatrix& pLSM);
00239 
00240     class RotationSpace
00241     {
00242     public:
00243         enum EMask {eHasNothing=0, eHasPreRotM=1<<0, eHasPostRotM=1<<1};
00244 
00245         RotationSpace();
00246 
00247         bool                HasPreRM();
00248         bool                HasPostRM();
00249         void                GetPreRM(FbxAMatrix& pPreRM);
00250         void                GetPostRM(FbxAMatrix& pPostRM);
00251         void                SetPreRM(FbxVector4& pPreR);
00252         void                SetPostRM(FbxVector4& pPostR);
00253         void                DoF2LRM(FbxAMatrix& pLRM, FbxVector4& pRDoF);
00254         void                LRM2DoF(FbxVector4& pRDoF, FbxAMatrix& pLRM);
00255 
00256         FbxUInt8            mMask;
00257         FbxAMatrix          mPreRM;
00258         FbxAMatrix          mPostRM;
00259         FbxRotationOrder    mRotationOrder;
00260     };
00261 
00262     enum EMask {eHasNothing=0, eHasRotOffset=1<<0, eHasRotPivot=1<<1, eHasScaleOffset=1<<2, eHasScalePivot=1<<3};
00263 
00264     FbxUInt8        mMask;
00265     EInheritType    mInheritType;   
00266     FbxVector4      mROffset;
00267     FbxVector4      mRPivot;
00268     FbxVector4      mSOffset;
00269     FbxVector4      mSPivot;
00270     FbxLimits       mTranslationLimits;
00271     FbxLimits       mRotationLimits;
00272     FbxLimits       mScalingLimits;
00273     bool            mRotationSpaceForLimitOnly;
00274     RotationSpace   mRotationSpace;
00275 };
00276 
00277 FBXSDK_DLL bool FbxGetContinuousRotation(FbxVector4& pRes, FbxVector4 pRot, FbxVector4 pRef, const int* pOrder);
00278 FBXSDK_DLL void FbxGetContinuousRotation(FbxVector4& pRes, FbxVector4 pRot, FbxVector4 pRef);
00279 
00280 #include <fbxsdk/fbxsdk_nsend.h>
00281 
00282 #endif /* _FBXSDK_CORE_MATH_TRANSFORMS_H_ */