From a39ea296322db3782e259524f980cc36807d0bd3 Mon Sep 17 00:00:00 2001 From: Daniele Bariletti Date: Wed, 12 Nov 2025 08:53:12 +0100 Subject: [PATCH 1/2] Include : - aggiunta classe inters curve plane. - aggiunta funzione surf ruled guided. --- EGkIntersCurvePlane.h | 109 ++++++++++++++++++++++++++++++++++++++++++ EGkSbzFromCurves.h | 1 + EXeExecutor.h | 1 + 3 files changed, 111 insertions(+) create mode 100644 EGkIntersCurvePlane.h diff --git a/EGkIntersCurvePlane.h b/EGkIntersCurvePlane.h new file mode 100644 index 0000000..0e1360a --- /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) ; + //! 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 e24d109..4fc11a8 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) ; From 69b3f4f555d2d3cfc480b5c31bd8928b1b39d2d5 Mon Sep 17 00:00:00 2001 From: Daniele Bariletti Date: Wed, 12 Nov 2025 13:09:16 +0100 Subject: [PATCH 2/2] Include : - aggiunto un parametro di ritorno alla inters curve-plane. --- EGkIntersCurvePlane.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EGkIntersCurvePlane.h b/EGkIntersCurvePlane.h index 0e1360a..f75202e 100644 --- a/EGkIntersCurvePlane.h +++ b/EGkIntersCurvePlane.h @@ -87,7 +87,7 @@ class IntersCurvePlane //! 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) ; + 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) ;