//---------------------------------------------------------------------------- // EgalTech 2013-2014 //---------------------------------------------------------------------------- // File : EGkFrame3d.h Data : 30.05.14 Versione : 1.5e10 // Contenuto : Dichiarazione della classe Reference Frame 3d. // // // // Modifiche : 04.01.13 DS Creazione modulo. // // //---------------------------------------------------------------------------- #pragma once #include "/EgtDev/Include/EGkPoint3d.h" //----------------------- Macro per import/export ---------------------------- #undef EGK_EXPORT #if defined( I_AM_EGK) // da definirsi solo nella DLL #define EGK_EXPORT __declspec( dllexport) #else #define EGK_EXPORT __declspec( dllimport) #endif //---------------------------------------------------------------------------- class EGK_EXPORT Frame3d { public : enum Type { ERR = 0, TOP = 1, BOTTOM = 2, FRONT = 3, BACK = 4, LEFT = 5, RIGHT = 6, GEN = 7} ; public : Frame3d( bool bGlob = true) : m_nType( bGlob ? TOP : ERR), m_nZType( bGlob ? TOP : ERR), m_ptOrig( ORIG), m_vtVersX( X_AX), m_vtVersY( Y_AX), m_vtVersZ( Z_AX) {} Frame3d( const Point3d& ptOrig) : m_nType( TOP), m_nZType( TOP), m_ptOrig( ptOrig), m_vtVersX( X_AX), m_vtVersY( Y_AX), m_vtVersZ( Z_AX) {} bool Set( const Point3d& ptOrig, const Vector3d& vtDirX, const Vector3d& vtDirY, const Vector3d& vtDirZ) ; bool Set( const Point3d& ptOrig, const Point3d& ptOnX, const Point3d& ptNearY) ; bool Set( const Point3d& ptOrig, const Vector3d& vtDirZ) ; bool Set( const Point3d& ptOrig, const Vector3d& vtDirZ, const Vector3d& vtNearDirX) ; bool Set( const Point3d& ptOrig, Type nType) ; bool Set( const Point3d& ptOrig, double dAngCDeg, double dAngADeg, double dAngC1Deg) ; bool Reset( bool bGlob = true) ; bool ChangeOrig( const Point3d& ptOrig) ; bool Translate( const Vector3d& vtMove) ; bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dAngDeg) ; bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, double dSinAng) ; bool PseudoScale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ) ; bool PseudoMirror( const Point3d& ptOn, const Vector3d& vtNorm) ; bool PseudoShear( const Point3d& ptOn, const Vector3d& vtNorm, const Vector3d& vtDir, double dCoeff) ; bool Invert( void) ; bool ToGlob( const Frame3d& frRef) ; bool ToLoc( const Frame3d& frRef) ; bool LocToLoc( const Frame3d& frOri, const Frame3d& frDest) ; Frame3d& operator*=( const Frame3d& frRef) { this->ToGlob( frRef) ; return *this ;} Frame3d& operator/=( const Frame3d& frRef) { this->ToLoc( frRef) ; return *this ;} bool IsValid( void) const { return ( m_nType != ERR) ; } int GetType( void) const { return m_nType ;} int GetZType( void) const { return m_nZType ;} const Point3d& Orig( void) const { return m_ptOrig ;} const Vector3d& VersX( void) const { return m_vtVersX ;} const Vector3d& VersY( void) const { return m_vtVersY ;} const Vector3d& VersZ( void) const { return m_vtVersZ ;} bool GetRotationsCAC1( double& dAngC, double& dAngA, double& dAngC1) const ; bool GetFixedAxesRotationsABC( double& dAngADeg, double& dAngBDeg, double& dAngCDeg) const ; private : bool Verify( void) ; void CalculateType( void) ; private : Type m_nType ; Type m_nZType ; Point3d m_ptOrig ; Vector3d m_vtVersX ; Vector3d m_vtVersY ; Vector3d m_vtVersZ ; } ; //---------------------------------------------------------------------------- // Riferimenti notevoli //---------------------------------------------------------------------------- const Frame3d GLOB_FRM ; //---------------------------------------------------------------------------- // Prodotto di due frame (porta il primo dal secondo nel globale) //---------------------------------------------------------------------------- inline Frame3d operator*( const Frame3d& frRef1, const Frame3d& frRef2) { Frame3d frRefR = frRef1 ; frRefR.ToGlob( frRef2) ; return frRefR ; } //---------------------------------------------------------------------------- // Divisione di due frame (porta il primo dal globale nel secondo) //---------------------------------------------------------------------------- inline Frame3d operator/( const Frame3d& frRef1, const Frame3d& frRef2) { Frame3d frRefR = frRef1 ; frRefR.ToLoc( frRef2) ; return frRefR ; } //---------------------------------------------------------------------------- // Verifica che due riferimenti sono coincidenti //---------------------------------------------------------------------------- inline bool AreSameFrame( const Frame3d& frRef1, const Frame3d& frRef2) { if ( frRef1.GetType() == Frame3d::ERR || frRef2.GetType() == Frame3d::ERR) return false ; if ( ! AreSamePointApprox( frRef1.Orig(), frRef2.Orig())) return false ; if ( ! AreSameVectorExact( frRef1.VersX(), frRef2.VersX())) return false ; if ( ! AreSameVectorExact( frRef1.VersY(), frRef2.VersY())) return false ; if ( ! AreSameVectorExact( frRef1.VersZ(), frRef2.VersZ())) return false ; return true ; }