EgtExecutor 1.9i4 :

- funzioni di intersezione raccolte in modulo apposito
- aggiunta funzione Exe e Lua BoxLineInters.
This commit is contained in:
Dario Sassi
2018-10-01 07:28:17 +00:00
parent b393ffe181
commit 984292fed9
16 changed files with 927 additions and 721 deletions
-68
View File
@@ -422,74 +422,6 @@ ExeVolZmapGetDepth( int nId, const Point3d& ptP, const Vector3d& vtDir, int nRef
return bOk ;
}
//----------------------------------------------------------------------------
int
MyVolZmapIntersPlane( int nId, const Plane3d& plPlane, int nDestGrpId, int nRefType, int* pnCount)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero il riferimento locale
Frame3d frLoc ;
if ( ! pGeomDB->GetGlobFrame( nId, frLoc))
return GDB_ID_NULL ;
// recupero il riferimento destinazione
Frame3d frDest ;
if ( ! pGeomDB->GetGlobFrame( nDestGrpId, frDest))
return GDB_ID_NULL ;
// porto in locale il piano
Plane3d plPlaneL = GetPlaneLocal( pGeomDB, plPlane, nRefType, frLoc) ;
// recupero lo Zmap e calcolo l'intersezione
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ;
ICURVEPOVECTOR vpLoop ;
if ( pVZM == nullptr || ! pVZM->GetPlaneIntersection( plPlaneL, vpLoop))
return GDB_ID_NULL ;
// inserisco le curve nel gruppo destinazione
int nFirstId = GDB_ID_NULL ;
int nCount = 0 ;
for ( size_t i = 0 ; i < vpLoop.size() ; ++ i) {
PtrOwner<ICurve> pCrv( Release( vpLoop[i])) ;
if ( IsNull( pCrv))
continue ;
pCrv->ToLoc( frDest) ;
// inserisco la curva composita nel gruppo destinazione
int nNewId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, ::Release( pCrv)) ;
if ( nNewId == GDB_ID_NULL)
return GDB_ID_NULL ;
if ( nFirstId == GDB_ID_NULL)
nFirstId = nNewId ;
++ nCount ;
}
// aggiorno contatore
if ( pnCount != nullptr)
*pnCount = nCount ;
// restituisco l'identificativo della prima nuova entità
return nFirstId ;
}
//----------------------------------------------------------------------------
int
ExeVolZmapIntersPlane( int nId, const Plane3d& plPlane, int nDestGrpId, int nRefType, int* pnCount)
{
// eseguo
int nCount = 0 ;
int nFirstId = MyVolZmapIntersPlane( nId, plPlane, nDestGrpId, nRefType, &nCount) ;
if ( pnCount != nullptr)
*pnCount = nCount ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtVolZmapIntersPlane(" + IdToString( nId) + ",{" +
ToString( ORIG + plPlane.GetVersN() * plPlane.GetDist()) + "},{" +
ToString( plPlane.GetVersN()) + "},{" +
ToString( nDestGrpId) + "}," +
RefTypeToString( nRefType) + ")" +
" -- Id=" + ToString( nFirstId) + ",Nbr=" + ToString( nCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della prima nuova entità
return nFirstId ;
}
//----------------------------------------------------------------------------
bool
ExeVolZmapAvoidBox( int nId, const Frame3d& frBox, const Vector3d& vtDiag, int nRefType)