00001
00002
00012
00013
00014 #if (_MSC_VER > 1000) || defined(SGI_COMPILER)
00015 #pragma once
00016 #endif
00017
00018
00019
00020
00021 #ifndef _TRANSFO_H_
00022 #define _TRANSFO_H_
00023
00024
00025
00026
00027 #include "SIBCMathLib.h"
00028
00029
00030
00031
00032
00033
00040 const unsigned char oSiTransfoSclFac = 0x01;
00041
00043 const unsigned char oSiTransfoSclRot = 0x02;
00044
00046 const unsigned char oSiTransfoAllScl = 0x03;
00047
00049 const unsigned char oSiTransfoRot = 0x04;
00050
00052 const unsigned char oSiTransfoTrs = 0x08;
00053
00055 const unsigned char oSiTransfoTrsAffectedByScl = 0x10;
00056
00058 const unsigned char oSiTransfoTrsAffectedByOri = 0x20;
00059
00061 const unsigned char oSiTransfoAllTrs = 0x38;
00062
00064 const unsigned char oSiTransfoNone = 0x00;
00065
00067 const unsigned char oSiTransfoAll = 0x3F;
00070
00071 typedef enum tagE3DSCLTYPE
00072 {
00073 XYZ_SCL_TYPE,
00074 UNIFORM_SCL_TYPE,
00075 VOLUMIC_SCL_TYPE
00076 } E3DSclType;
00077
00079 typedef enum tagE3DTRANSFOSPACE
00080 {
00081 LOCAL_TRANSFO_SPACE,
00082 PARENT_TRANSFO_SPACE,
00083 OTHER_TRANSFO_SPACE
00084 } E3DTransfoSpace;
00085
00087 typedef enum tagE3DVECTORTYPE
00088 {
00089 POINT_VECTOR_TYPE,
00090 LINE_VECTOR_TYPE,
00091 DIRECTION_VECTOR_TYPE
00092 } E3DVectorType;
00093
00094
00095
00096
00097
00098
00099 #define MASK_ARE_COMPONENTS_DIRTY (1 << 0 ) // 0x1 00000001
00100 #define MASK_IS_XFOMAT_DIRTY (1 << 1 ) // 0x2 00000010
00101 #define MASK_IS_SI_SCALING (1 << 2 ) // 0x4 00000100
00102
00105 class XSICOREEXPORT CSIBCTransfod
00106 {
00107 public:
00110 CSIBCTransfod();
00111
00118 CSIBCTransfod(
00119 const CSIBCVector3Dd& in_vctScl,
00120 const CSIBCRotationd& in_rotScl,
00121 const CSIBCRotationd& in_rot,
00122 const CSIBCVector3Dd& in_vctTrs );
00123
00129 CSIBCTransfod(
00130 const CSIBCVector3Dd& in_vctScl,
00131 const CSIBCRotationd& in_rot,
00132 const CSIBCVector3Dd& in_vctTrs );
00133
00138 CSIBCTransfod(
00139 const CSIBCVector3Dd& in_vctScl,
00140 const CSIBCRotationd& in_rotScl );
00141
00146 bool GetSIScalingFlag() const;
00147
00154 CSIBCTransfod& SetSIScalingFlag( const bool in_bSIScaling );
00155
00160 bool IsScalingOrientationExisting() const;
00161
00163
00164
00165
00166
00167
00169
00174 CSIBCVector3Dd& GetScaling( CSIBCVector3Dd& out_vctScl );
00175
00182 void GetScaling(
00183 double& out_dX,
00184 double& out_dY,
00185 double& out_dZ );
00186
00191 void GetScaling(
00192 CSIBCVector3Dd& out_vctScl,
00193 CSIBCRotationd& out_rotSclOri );
00194
00199 CSIBCRotationd& GetScalingOrientation( CSIBCRotationd& in_rotSclOri );
00200
00205 CSIBCVector3Dd& GetScalingOrientation( CSIBCVector3Dd& out_vctSclOri );
00206
00212 void GetScalingOrientation(
00213 double& out_rdX,
00214 double& out_rdY,
00215 double& out_rdZ );
00216
00221 CSIBCRotationd& GetRotation( CSIBCRotationd& out_rot );
00222
00227 CSIBCQuaterniond& GetRotation( CSIBCQuaterniond& out_quat );
00228
00233 CSIBCRotMatd& GetRotation( CSIBCRotMatd& out_matRot );
00234
00244 const CSIBCRotMatd* GetRotation();
00245
00250 CSIBCVector3Dd& GetRotation( CSIBCVector3Dd& out_vctXYZAngles );
00251
00257 void GetRotation(
00258 double& out_dX,
00259 double& out_dY,
00260 double& out_dZ );
00261
00266 void GetRotation(
00267 CSIBCVector3Dd& out_vctAxis,
00268 double& out_dAngle );
00269
00274 CSIBCVector3Dd& GetTranslation( CSIBCVector3Dd& out_vctTrs );
00275
00281 void GetTranslation(
00282 double& out_dX,
00283 double& out_dY,
00284 double& out_dZ );
00285
00294 const CSIBCXfoMatd* GetMatrix();
00295
00296
00301 CSIBCXfoMatd& GetMatrix( CSIBCXfoMatd& out_matXfo );
00302
00307 CSIBCXfoMatd& GetInvMatrix( CSIBCXfoMatd& out_matInvXfo );
00308
00316 CSIBCTransfod& Set(
00317 const CSIBCVector3Dd& in_vctScl,
00318 const CSIBCRotationd& in_rotScl,
00319 const CSIBCRotationd& in_rot,
00320 const CSIBCVector3Dd& in_vctTrs );
00321
00328 CSIBCTransfod& Set(
00329 const CSIBCVector3Dd& in_vctScl,
00330 const CSIBCRotationd& in_rot,
00331 const CSIBCVector3Dd& in_vctTrs );
00332
00337 CSIBCTransfod& Set( const CSIBCTransfod& in_xfo );
00338
00343 CSIBCTransfod& Set( const CSIBCXfoMatd& in_matXfo );
00344
00349 CSIBCTransfod& Set( const CSIBCRotationd& in_rot );
00350
00355 CSIBCTransfod& Set( const CSIBCVector3Dd& in_vct );
00356
00361 CSIBCTransfod& SetScaling( const CSIBCVector3Dd& in_vctScl );
00362
00370 CSIBCTransfod& SetScaling(
00371 double in_dX,
00372 double in_dY,
00373 double in_dZ );
00374
00380 CSIBCTransfod& SetScaling(
00381 const CSIBCVector3Dd& in_vctScl,
00382 const CSIBCRotationd& in_rotSclOri );
00383
00388 CSIBCTransfod& SetScalingOrientation( const CSIBCRotationd& in_rotSclOri );
00389
00394 CSIBCTransfod& SetScalingOrientation( const CSIBCVector3Dd& in_vctSclOri );
00395
00403 CSIBCTransfod& SetScalingOrientation(
00404 const double in_dX,
00405 const double in_dY,
00406 const double in_dZ );
00407
00408
00413 CSIBCTransfod& SetRotation( const CSIBCRotationd& in_rot );
00414
00419 CSIBCTransfod& SetRotation( const CSIBCQuaterniond& in_quat );
00420
00425 CSIBCTransfod& SetRotation( const CSIBCRotMatd& in_matRot );
00426
00431 CSIBCTransfod& SetRotation( const CSIBCVector3Dd& in_vctXYZAngles );
00432
00439 CSIBCTransfod& SetRotation(
00440 double in_dX,
00441 double in_dY,
00442 double in_dZ );
00443
00449 CSIBCTransfod& SetRotation(
00450 const E3DAxisType in_axis,
00451 const double in_dAngle );
00452
00458 CSIBCTransfod& SetRotation(
00459 const CSIBCVector3Dd& in_vctAxis,
00460 const double in_dAngle );
00461
00472 bool SetRotation(
00473 const CSIBCVector3Dd& in_vctFrom,
00474 const CSIBCVector3Dd& in_vctTo,
00475 int& out_bFlip );
00476
00484 CSIBCTransfod& SetRotation(
00485 const CSIBCVector3Dd& in_vctX,
00486 const CSIBCVector3Dd& in_vctY,
00487 const CSIBCVector3Dd& in_vctZ );
00488
00493 CSIBCTransfod& SetTranslation( const CSIBCVector3Dd& in_vctTrs );
00494
00501 CSIBCTransfod& SetTranslation(
00502 double in_dX,
00503 double in_dY,
00504 double in_dZ );
00505
00512 CSIBCTransfod& SetIdentity( const unsigned char in_oWhichTransfo = oSiTransfoAll );
00513
00518 CSIBCTransfod& Invert( CSIBCTransfod& in_xfo );
00519
00523 CSIBCTransfod& Invert();
00524
00562 CSIBCTransfod& Mul(
00563 CSIBCTransfod& in_xfo1,
00564 CSIBCTransfod& in_xfo2,
00565 unsigned char in_oWhichComponents = oSiTransfoAll );
00566
00575 CSIBCTransfod& Mul(
00576 CSIBCTransfod& in_xfo,
00577 unsigned char in_oWhichComponents = oSiTransfoAll );
00578
00606 CSIBCTransfod& Dif(
00607 CSIBCTransfod& in_xfo1,
00608 CSIBCTransfod& in_xfo2,
00609 unsigned char in_oWhichComponents = oSiTransfoAll,
00610 CSIBCTransfod* in_pXfo3 = NULL );
00611
00616 CSIBCTransfod& MapSpaceToWorld( CSIBCTransfod& in_xfoFrom );
00617
00622 CSIBCTransfod& MapWorldToSpace( CSIBCTransfod& in_xfoTo );
00623
00629 CSIBCTransfod& MapSpaceToSpace(
00630 CSIBCTransfod& in_xfoFrom,
00631 CSIBCTransfod& in_xfoTo );
00632
00661 CSIBCTransfod& AddScaling(
00662 const CSIBCVector3Dd& in_vctSclApplied,
00663 const E3DTransfoSpace in_eAlong = LOCAL_TRANSFO_SPACE,
00664 CSIBCRotationd* in_protAlong = NULL,
00665 const E3DTransfoSpace in_eAbout = LOCAL_TRANSFO_SPACE,
00666 const CSIBCVector3Dd* in_pvctAbout = NULL,
00667 const E3DSclType in_eSclType = XYZ_SCL_TYPE );
00668
00694 CSIBCTransfod& AddRotation(
00695 CSIBCRotationd& in_rotApplied,
00696 const E3DTransfoSpace in_eAlong = LOCAL_TRANSFO_SPACE,
00697 CSIBCRotationd* in_protAlong = NULL,
00698 const E3DTransfoSpace in_eAround = LOCAL_TRANSFO_SPACE,
00699 const CSIBCVector3Dd* in_pvctAround = NULL,
00700 bool in_bIncrementEulerAngles = false);
00701
00722 CSIBCTransfod& AddTranslation(
00723 const CSIBCVector3Dd& in_vctTrsApplied,
00724 const E3DTransfoSpace in_eAlong = LOCAL_TRANSFO_SPACE,
00725 CSIBCRotationd* in_protAlong = NULL );
00726
00753 CSIBCTransfod& AddScalingOrientation(
00754 CSIBCRotationd& in_rotApplied,
00755 const E3DTransfoSpace in_eAlong = LOCAL_TRANSFO_SPACE,
00756 CSIBCRotationd* in_protAlong = NULL,
00757 const E3DTransfoSpace in_eAround = LOCAL_TRANSFO_SPACE,
00758 const CSIBCVector3Dd* in_pvctAround = NULL,
00759 bool in_bIncrementEulerAngles = false);
00760
00768 friend CSIBCXfoMatd& GetMapSpaceToWorld(
00769 const E3DVectorType in_eVctType,
00770 CSIBCTransfod& in_xfoFrom,
00771 CSIBCXfoMatd& out_matXfo );
00772
00780 friend CSIBCXfoMatd& GetMapWorldToSpace(
00781 const E3DVectorType in_eVctType,
00782 CSIBCTransfod& in_xfoTo,
00783 CSIBCXfoMatd& out_matXfo );
00784
00793 friend CSIBCXfoMatd& GetMapSpaceToSpace(
00794 const E3DVectorType in_eVctType,
00795 CSIBCTransfod& in_xfoFrom,
00796 CSIBCTransfod& in_xfoTo,
00797 CSIBCXfoMatd& out_matXfo );
00798
00799
00800 protected:
00801
00802
00803
00804
00805
00806
00807
00808
00809
00810
00811
00812 void Factorize( const unsigned char in_oWhichComponents = oSiTransfoAll );
00813 void Combine();
00814
00815
00816 void Init();
00817
00818
00819 private:
00820
00821
00822
00823
00824 CSIBCRotationd m_rot;
00825 CSIBCXfoMatd m_matXfo;
00826
00827
00828 CSIBCVector3Dd m_vctScl;
00829 CSIBCVector3Dd m_vctTrs;
00830 CSIBCRotationd* m_pSclOri;
00831
00832
00833
00834
00835
00836
00837
00838
00839
00840
00841
00842
00843
00844
00845
00846
00847
00848
00849
00850
00851
00852
00853
00854
00855
00856
00857 #ifdef _DEBUG
00858
00859 bool m_bComponentsDirty;
00860 bool m_bXfoMatDirty;
00861
00862
00863
00864
00865 bool m_bSIScaling;
00866 #endif
00867
00868
00869
00870
00871
00872
00873
00874
00875
00876 unsigned char m_oTransfoInfo;
00877
00878 void _SetComponentsDirty( const bool in_bIsDirty );
00879 bool _AreComponentsDirty() const;
00880 void _SetXfoMatDirty ( const bool in_bIsDirty );
00881 bool _IsXfoMatDirty() const;
00882 void _SetSIScaling( const bool in_bIsScaling );
00883 bool _IsSIScaling() const;
00884 bool HasShearing() const;
00885 void _AllocateScalingOrientationMatrix(const bool in_bAllocate);
00886
00887
00888
00889
00890 CSIBCTransfod( const CSIBCTransfod& in_xfo );
00891 CSIBCTransfod( const CSIBCXfoMatd& in_matXfo );
00892 CSIBCTransfod( const CSIBCRotationd& in_rot );
00893 CSIBCTransfod( const CSIBCVector3Dd& in_vctTrs );
00894
00895
00896 CSIBCTransfod& operator =( const CSIBCTransfod& in_xfo );
00897 CSIBCTransfod& operator =( const CSIBCXfoMatd& in_matXfo );
00898 };
00899
00900 typedef CSIBCTransfod* LP3DTRANSFO;
00901 typedef const CSIBCTransfod* LPC3DTRANSFO;
00902
00903
00904 #endif