diff --git a/EGkIntersCurvePlane.h b/EGkIntersCurvePlane.h new file mode 100644 index 0000000..f75202e --- /dev/null +++ b/EGkIntersCurvePlane.h @@ -0,0 +1,109 @@ +//---------------------------------------------------------------------------- +// EgalTech 2025 +//---------------------------------------------------------------------------- +// File : EGkIntersCurvePlane.h Data : 07.11.25 Versione : 2.7k1 +// Contenuto : Dichiarazione della classe intersezione curva-piano. +// +// +// +// Modifiche : 07.11.25 DB Creazione modulo. +// +// +// +//---------------------------------------------------------------------------- + +#pragma once + +#include "/EgtDev/Include/EGkPoint3d.h" +#include "/EgtDev/Include/EGkCurve.h" +#include "/EgtDev/Include/EGkIntersCurves.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 + +//----------------------------------------------------------------------------- +// Tipo di intersezione +// nulla +// puntiforme +// sovrapposizione + +// Costanti per tipo di approccio/allontanamento dall'intersezione +const int ICPT_NULL = 0 ; //!< Approccio/allontanamento non definito +const int ICPT_IN = 1 ; //!< Approccio/allontanamento interno +const int ICPT_OUT = 2 ; //!< Approccio/allontanamento esterno +const int ICPT_ON = 3 ; //!< Approccio/allontanamento sovrapposto + +//! dati di intersezione tra una curva e un piano +struct IntCrvPlnInfo { + bool bOverlap ; //!< intersezione con overlap + IntCrvInfo Ici[2] ; //!< Ici[0] intersez. isolata o inizio overlap, Ici[1] fine overlap + // costruttore + IntCrvPlnInfo( void) + : bOverlap( false) {} +} ; +//! vettore di IntCrvPlnInfo +typedef std::vector ICPIVECTOR ; + +//----------------------------------------------------------------------------- +//! Classificazione di parti di curva rispetto ad un piano +struct CrvPlaneClass { + double dParS ; + double dParE ; + int nClass ; + // costruttori + CrvPlaneClass( void) + : dParS( 0), dParE( 0), nClass( 0) {} + CrvPlaneClass( double dPS, double dPE, int nC) + : dParS( dPS), dParE( dPE), nClass( nC) {} +} ; +//! Vettore di CrvPlaneClass +typedef std::vector CRVPLNCVECTOR ; + +//----------------------------------------------------------------------------- +// Costanti per classe parti di curva rispetto ad un piano +const int CRVPLN_NULL = 0 ; //!< Parte di curva non classificabile +const int CRVPLN_IN = 1 ; //!< Parte di curva interna ( dal lato negativo della normale) +const int CRVPLN_OUT = 2 ; //!< Parte di curva esterna ( dal lato positivo della normale) +const int CRVPLN_ON = 3 ; //!< Parte di curva sovrapposta al piano + +//----------------------------------------------------------------------------- +//! Classe per calcolo intersezione tra una curve e un piano, nel riferimento locale del piano +class IntersCurvePlane +{ + public : + //! Le intersezioni sono calcolate nel piano XY locale.
+ EGK_EXPORT IntersCurvePlane( const ICurve& CurveA, const Point3d& ptOrig, const Vector3d& vtN) ; + + public : + //! Indica la presenza di intersezioni con sovrapposizioni + EGK_EXPORT bool GetOverlaps( void) ; + //! Restituisce il numero di intersezioni (intersezioni doppie coincidenti e sovrapposte contano uno) + EGK_EXPORT int GetIntersCount( void) ; + //! Restituisce informazioni sull'intersezione di indice nInd ( 0 based) + EGK_EXPORT bool GetIntCrvPlnInfo( int nInd, IntCrvPlnInfo& aInfo) ; + //! Restituisce il punto di intersezione pił vicino al punto passato + EGK_EXPORT bool GetIntersPointNearTo( const Point3d& ptNear, Point3d& ptI, double& dParam) ; + //! Restituisce la classificazione di una curva rispetto al piano + EGK_EXPORT bool GetCurveClassification( double dLenMin, CRVPLNCVECTOR& ccClass) ; + + private : + IntersCurvePlane( void) ; + bool CalcIntersLinePlane( const Plane3d& plPlane, const ICurve& Curve, int nCrv = 0) ; + bool IsArcToApprox( const ICurve& Curve) ; + bool AdjustIntersParams( bool bAdjCrv) ; + bool CalcCurveClassification( const ICurve* pCurve, const ICPIVECTOR& Info, double dLenMin, CRVPLNCVECTOR& ccClass) ; + bool CalcCurveInOrOut( const ICurve* pCurve, CRVPLNCVECTOR& ccClass) ; + void OrderAndCompleteIntersections() ; + + private : + int m_nIntersType ; + int m_nIntersCount ; + ICPIVECTOR m_Info ; + const ICurve* m_pCurve ; // puntatore alla curva + Plane3d m_plPlane ; +} ; \ No newline at end of file diff --git a/EGkSbzFromCurves.h b/EGkSbzFromCurves.h index f90fdc0..473dca2 100644 --- a/EGkSbzFromCurves.h +++ b/EGkSbzFromCurves.h @@ -44,6 +44,7 @@ EGK_EXPORT ISurfBezier* GetSurfBezierByScrewing( const ICurve* pCurve, const Poi //EGK_EXPORT ISurfBezier* GetSurfBezierTransSwept( const ICurve* pSect, const ICurve* pGuide, bool bCapEnds, double dLinTol = 10 * EPS_SMALL) ; EGK_EXPORT ISurfBezier* GetSurfBezierRuled( const Point3d& ptP, const ICurve* pCurve, double dLinTol = 10 * EPS_SMALL) ; EGK_EXPORT ISurfBezier* GetSurfBezierRuled( const ICurve* pCurve1, const ICurve* pCurve2, int nType, double dLinTol = 10 * EPS_SMALL) ; +EGK_EXPORT ISurfBezier* GetSurfBezierRuledGuided( const ICurve* pCurve1, const ICurve* pCurve2, const ICURVEPOVECTOR& vCrv, double dLinTol = 10 * EPS_SMALL) ; EGK_EXPORT ISurfBezier* GetSurfBezierSkinned( const CICURVEPVECTOR& vCrv, double dLinTol = 10 * EPS_SMALL) ; EGK_EXPORT ISurfBezier* GetSurfBezierSweptInPlane( const ICurve* pSect, const ICurve* pGuide, const Vector3d& vtNorm, bool bCapEnds, double dLinTol = 10 * EPS_SMALL) ; EGK_EXPORT ISurfBezier* GetSurfBezierSwept3d( const ICurve* pSect, const ICurve* pGuide, const Vector3d& vtNorm, bool bCapEnds, double dLinTol = 10 * EPS_SMALL) ; diff --git a/EXeExecutor.h b/EXeExecutor.h index 595f4c6..b273a1e 100644 --- a/EXeExecutor.h +++ b/EXeExecutor.h @@ -420,6 +420,7 @@ EXE_EXPORT int ExeCreateSurfBzByRevolve( int nParentId, int nCrvId, bool bCapEnds, double dLinTol, int nRefType) ; EXE_EXPORT int ExeCreateSurfBzByPointCurve( int nParentId, int nCrvId, const Point3d& ptAx, bool bCapEnds, double dLinTol, int nRefType) ; EXE_EXPORT int ExeCreateSurfBzRuled( int nParentId, int nCrvId1, int nCrvId2, int nRuledType, bool bCapEnds, double dLinTol) ; +EXE_EXPORT int ExeCreateSurfBzRuledGuided( int nParentId, int nCrvId1, int nCrvId2, int nLayGuides, bool bCapEnds, double dLinTol) ; EXE_EXPORT int ExeCreateSurfBzSkinned( int nParentId, const INTVECTOR& nCrvId1, bool bCapEnds, double dLinTol) ; EXE_EXPORT int ExeCreateSurfBzSwept( int nParentId, int nSectId, int nGuideId, const Vector3d& vtAx, bool bCapEnds, double dLinTol, int nRefType) ;