EgtExecutor :

- aggiunto funioni alla IntersCurveCurve per filtrare le intersezioni 3D.
This commit is contained in:
Daniele Bariletti
2025-11-19 13:08:36 +01:00
parent 2407fef277
commit 6f8e37c9ee
2 changed files with 21 additions and 9 deletions
+17 -7
View File
@@ -1016,7 +1016,7 @@ ExePlaneVolZmapInters( const Point3d& ptOn, const Vector3d& vtN, int nId, int nD
//-------------------------------------------------------------------------------
int
MyCurveCurveInters( const int nId1, const int nId2, const int nDestGrpId, int& nPntCount, int& nCrvCount)
MyCurveCurveInters( const int nId1, const int nId2, const int nDestGrpId, int& nPntCount, int& nCrvCount, bool bOnly3D)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
@@ -1034,12 +1034,19 @@ MyCurveCurveInters( const int nId1, const int nId2, const int nDestGrpId, int& n
// intersezione fra le curve nel piano XY locale
IntersCurveCurve intCC( *Crv1Loc, *Crv2Loc, true) ;
int nInters = intCC.GetIntersCount() ;
int nInters = 0 ;
if ( ! bOnly3D)
nInters = intCC.GetIntersCount() ;
else
nInters = intCC.GetInters3DCount() ;
// recupero i punti risultanti
for ( int i = 0 ; i < nInters ; i++) {
IntCrvCrvInfo aInfo ;
intCC.GetIntCrvCrvInfo( i, aInfo) ;
IntCrvCrvInfo aInfo ;
if( ! bOnly3D)
intCC.GetIntCrvCrvInfo( i, aInfo) ;
else
intCC.GetInt3DCrvCrvInfo( i, aInfo) ;
// verifico se punto
if ( ! aInfo.bOverlap) {
PtrOwner<IGeoPoint3d> pGeoPnt( CreateGeoPoint3d()) ;
@@ -1060,7 +1067,10 @@ MyCurveCurveInters( const int nId1, const int nId2, const int nDestGrpId, int& n
// recupero le curve risultanti
for ( int i = 0 ; i < nInters ; i++) {
IntCrvCrvInfo aInfo ;
intCC.GetIntCrvCrvInfo( i, aInfo) ;
if( ! bOnly3D)
intCC.GetIntCrvCrvInfo( i, aInfo) ;
else
intCC.GetInt3DCrvCrvInfo( i, aInfo) ;
// verifico se curva
if ( aInfo.bOverlap) {
PtrOwner<ICurve> pCrvRes( Crv1Loc->CopyParamRange( aInfo.IciA[0].dU, aInfo.IciA[1].dU)) ;
@@ -1082,11 +1092,11 @@ MyCurveCurveInters( const int nId1, const int nId2, const int nDestGrpId, int& n
//-------------------------------------------------------------------------------
int
ExeCurveCurveInters( const int nId1, const int nId2, const int nDestGrpId, int* pnPntCount, int* pnCrvCount)
ExeCurveCurveInters( const int nId1, const int nId2, const int nDestGrpId, int* pnPntCount, int* pnCrvCount, bool bOnly3D)
{
// eseguo
int nPntCount{ 0}, nCrvCount{ 0} ;
int nFirstId = MyCurveCurveInters( nId1, nId2, nDestGrpId, nPntCount, nCrvCount) ;
int nFirstId = MyCurveCurveInters( nId1, nId2, nDestGrpId, nPntCount, nCrvCount, bOnly3D) ;
// aggiorno contatori
if ( nFirstId != GDB_ID_NULL) {
if ( pnPntCount != nullptr)
+4 -2
View File
@@ -354,18 +354,20 @@ LuaPlaneVolZmapInters( lua_State* L)
static int
LuaCurveCurveInters( lua_State* L)
{
// 3 parametri : nId1, nId2, nDestGrpId
// 3 o 4 parametri : nId1, nId2, nDestGrpId [, bOnly3D]
int nId1 ;
LuaCheckParam( L, 1, nId1)
int nId2 ;
LuaCheckParam( L, 2, nId2)
int nDestGrpId ;
LuaCheckParam( L, 3, nDestGrpId) ;
bool bOnly3D = false ;
LuaGetParam( L, 4, bOnly3D) ;
LuaClearStack( L) ;
// eseguo l'intersezione
int nPntCount = 0 ;
int nCrvCount = 0 ;
int nNewId = ExeCurveCurveInters( nId1, nId2, nDestGrpId, &nPntCount, &nCrvCount) ;
int nNewId = ExeCurveCurveInters( nId1, nId2, nDestGrpId, &nPntCount, &nCrvCount, bOnly3D) ;
// restituisco il risultato
if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ;