From 062512cd2e17ed59f7a47ff9a0d3eb13068852bf Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Mon, 13 May 2024 15:14:12 +0200 Subject: [PATCH] Include : - aggiunto include per DistLineLine. --- EGkDistLineLine.h | 60 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 EGkDistLineLine.h diff --git a/EGkDistLineLine.h b/EGkDistLineLine.h new file mode 100644 index 0000000..1fa0203 --- /dev/null +++ b/EGkDistLineLine.h @@ -0,0 +1,60 @@ +//---------------------------------------------------------------------------- +// 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 ; +} ;