//---------------------------------------------------------------------------- // EgalTech 2020-2024 //---------------------------------------------------------------------------- // File : EGkDistLineLine.h Data : 10.05.24 Versione : 2.6e31 // Contenuto : Dichiarazione della classe distanza fra elementi lineari. // // // // Modifiche : 06.11.20 LM Creazione modulo. // 10.05.24 DS Portata in Include. // //---------------------------------------------------------------------------- #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 DistLineLine { public : EGK_EXPORT DistLineLine( const Point3d& ptSt1, const Point3d& ptEn1, const Point3d& ptSt2, const Point3d& ptEn2, bool bIsSegment1 = true, bool bIsSegment2 = true) ; EGK_EXPORT DistLineLine( const Point3d& ptSt1, const Vector3d& vtD1, double dLen1, const Point3d& ptSt2, const Vector3d& vtD2, double dLen2, bool bIsSegment1 = true, bool bIsSegment2 = true) ; public : EGK_EXPORT bool GetSqDist( double& dSqDist) const ; EGK_EXPORT bool GetDist( double& dDist) const ; EGK_EXPORT bool IsEpsilon( double dTol) const { double dSqDist ; return ( GetSqDist( dSqDist) && ( dSqDist < SQ_EPS_ZERO || dSqDist < dTol * dTol)) ; } EGK_EXPORT bool IsSmall( void) const { return IsEpsilon( EPS_SMALL) ; } EGK_EXPORT bool IsZero( void) const { return IsEpsilon( EPS_ZERO) ; } EGK_EXPORT bool GetMinDistPoints( Point3d& ptMinDist1, Point3d& ptMinDist2) const ; EGK_EXPORT bool GetPositionsAtMinDistPoints( double& dPos1, double& dPos2) const ; private : void Calculate( const Point3d& ptSt1, const Vector3d& vtD1, double dLen1, const Point3d& ptSt2, const Vector3d& vtD2, double dLen2, bool bIsSegment1, bool bIsSegment2) ; private: double m_dSqDist ; mutable double m_dDist ; double m_dPos1 ; double m_dPos2 ; Point3d m_ptMinDist1 ; Point3d m_ptMinDist2 ; } ;