fbxtransforms.h

Go to the documentation of this file.
00001 /****************************************************************************************
00002  
00003    Copyright (C) 2012 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/fbxaffinematrix.h>
00020 #include <fbxsdk/core/math/fbxquaternion.h>
00021 #include <fbxsdk/core/math/fbxvector4.h>
00022 
00023 #include <fbxsdk/fbxsdk_nsbegin.h>
00024 
00036 class FBXSDK_DLL FbxLimits
00037 {
00038 public:
00040     FbxLimits();
00041 
00043     FbxLimits& operator=(const FbxLimits& pLimits);
00044 
00048     bool GetActive() const;
00049 
00053     void SetActive(const bool& pActive);
00054 
00058     bool GetMinXActive() const;
00059 
00063     bool GetMinYActive() const;
00064 
00068     bool GetMinZActive() const;
00069 
00075     void GetMinActive(bool& pXActive, bool& pYActive, bool& pZActive) const;
00076 
00080     FbxDouble3 GetMin() const;
00081 
00085     void SetMinXActive(const bool& pActive);
00086 
00090     void SetMinYActive(const bool& pActive);
00091 
00095     void SetMinZActive(const bool& pActive);
00096 
00102     void SetMinActive(const bool& pXActive, const bool& pYActive, const bool& pZActive);
00103 
00107     void SetMin(const FbxDouble3& pMin);
00108 
00112     bool GetMaxXActive() const;
00113 
00117     bool GetMaxYActive() const;
00118 
00122     bool GetMaxZActive() const;
00123 
00129     void GetMaxActive(bool& pXActive, bool& pYActive, bool& pZActive) const;
00130 
00134     FbxDouble3 GetMax() const;
00135 
00139     void SetMaxXActive(const bool& pActive);
00140 
00144     void SetMaxYActive(const bool& pActive);
00145 
00149     void SetMaxZActive(const bool& pActive);
00150 
00156     void SetMaxActive(const bool& pXActive, const bool& pYActive, const bool& pZActive);
00157 
00161     void SetMax(const FbxDouble3& pMax);
00162 
00167     bool GetAnyMinMaxActive() const;
00168     
00172     FbxDouble3 Apply(const FbxDouble3& pVector);
00173 
00175 //
00176 //  WARNING!
00177 //
00178 //  Anything beyond these lines may not be documented accurately and is
00179 //  subject to change without notice.
00180 //
00182 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00183 private:
00184     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};
00185 
00186     FbxUInt8    mMask;
00187     FbxDouble3  mMin;
00188     FbxDouble3  mMax;
00189 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
00190 };
00191 
00192 class FBXSDK_DLL FbxRotationOrder
00193 {
00194 public: 
00195     FbxRotationOrder(int pOrder=FbxEuler::eOrderXYZ);
00196 
00197     int     GetOrder();
00198     void    SetOrder(int pOrder);
00199     void    V2M(FbxAMatrix& pRM, const FbxVector4& pV);
00200     void    M2V(FbxVector4& pV, FbxAMatrix& pRM);
00201     bool    V2VRef(FbxVector4& pVOut, FbxVector4& pVIn, FbxVector4& pVRef);
00202 
00203 private:
00204     int     mOrder;
00205 };
00206 
00209 class FBXSDK_DLL FbxTransform
00210 {
00211 public:
00212     enum EInheritType {eInheritRrSs, eInheritRSrs, eInheritRrs};
00213 
00214     FbxTransform();
00215 
00216     EInheritType        GetInheritType();
00217     void                SetInheritType(EInheritType pType);
00218     FbxLimits&          GetTranslationLimits();
00219     FbxLimits&          GetRotationLimits();
00220     FbxLimits&          GetScalingLimits();
00221     FbxRotationOrder&   GetRotationOrder();
00222     bool                HasROffset();
00223     bool                HasRPivot();
00224     bool                HasSOffset();
00225     bool                HasSPivot();
00226     bool                HasPreRM();
00227     bool                HasPostRM();
00228     void                SetROffset(FbxVector4& pROffset);
00229     void                SetRPivot(FbxVector4& pRPivot);
00230     void                SetSOffset(FbxVector4& pSOffset);
00231     void                SetSPivot(FbxVector4& pSPivot);
00232     void                SetPreRM(FbxVector4& pPreR);
00233     void                SetPostRM(FbxVector4& pPostR);
00234     bool                GetRotationSpaceForLimitOnly();
00235     void                SetRotationSpaceForLimitOnly(bool pRotationSpaceForLimitOnly);
00236 
00237     void                DoF2LT(FbxVector4& pLT, FbxVector4& pDoF, FbxAMatrix& pLRM, FbxAMatrix& pLSM);
00238     void                LT2DoF(FbxVector4& pDoF, FbxVector4 pLT, FbxAMatrix& pLRM, FbxAMatrix& pLSM);
00239     void                DoF2LRM(FbxAMatrix& pLRM, FbxVector4& pRDoF, bool pForLimit=false);
00240     void                LRM2DoF(FbxVector4& pRDoF, FbxAMatrix& pLRM, bool pForLimit=false);
00241     void                LSM2GSM(FbxAMatrix& pGSM, FbxAMatrix& pPGSM, FbxAMatrix& pLSM, FbxAMatrix& pLRM);
00242     void                GTRSM2GX(FbxAMatrix& pGX, FbxVector4& pGT, FbxAMatrix& pGRM, FbxAMatrix& pGSM);
00243 
00244 private:
00245     void                SumPivots(FbxVector4& pSum, FbxAMatrix& pLRM, FbxAMatrix& pLSM);
00246 
00247     class RotationSpace
00248     {
00249     public:
00250         enum EMask {eHasNothing=0, eHasPreRotM=1<<0, eHasPostRotM=1<<1};
00251 
00252         RotationSpace();
00253 
00254         bool                HasPreRM();
00255         bool                HasPostRM();
00256         void                GetPreRM(FbxAMatrix& pPreRM);
00257         void                GetPostRM(FbxAMatrix& pPostRM);
00258         void                SetPreRM(FbxVector4& pPreR);
00259         void                SetPostRM(FbxVector4& pPostR);
00260         void                DoF2LRM(FbxAMatrix& pLRM, FbxVector4& pRDoF);
00261         void                LRM2DoF(FbxVector4& pRDoF, FbxAMatrix& pLRM);
00262 
00263         FbxUInt8            mMask;
00264         FbxAMatrix          mPreRM;
00265         FbxAMatrix          mPostRM;
00266         FbxRotationOrder    mRotationOrder;
00267     };
00268 
00269     enum EMask {eHasNothing=0, eHasRotOffset=1<<0, eHasRotPivot=1<<1, eHasScaleOffset=1<<2, eHasScalePivot=1<<3};
00270 
00271     FbxUInt8        mMask;
00272     EInheritType    mInheritType;   
00273     FbxVector4      mROffset;
00274     FbxVector4      mRPivot;
00275     FbxVector4      mSOffset;
00276     FbxVector4      mSPivot;
00277     FbxLimits       mTranslationLimits;
00278     FbxLimits       mRotationLimits;
00279     FbxLimits       mScalingLimits;
00280     bool            mRotationSpaceForLimitOnly;
00281     RotationSpace   mRotationSpace;
00282 };
00283 
00284 FBXSDK_DLL bool FbxGetContinuousRotation(FbxVector4& pRes, FbxVector4 pRot, FbxVector4 pRef, const int* pOrder);
00285 FBXSDK_DLL void FbxGetContinuousRotation(FbxVector4& pRes, FbxVector4 pRot, FbxVector4 pRef);
00286 
00287 #include <fbxsdk/fbxsdk_nsend.h>
00288 
00289 #endif /* _FBXSDK_CORE_MATH_TRANSFORMS_H_ */