EgtExecutor :

- correzione del merge.
This commit is contained in:
Daniele Bariletti
2024-02-27 17:30:38 +01:00
parent ce92c8f6c9
commit 49d2600cc7
+112 -1
View File
@@ -201,10 +201,121 @@ MyLineSurfTmInters( const Point3d& ptP, const Vector3d& vtDir, int nId, int nRef
return true ;
}
//-------------------------------------------------------------------------------
bool
ExeLineSurfTmInters( const Point3d& ptP, const Vector3d& vtDir, int nId, int nRefType,
INTDBLVECTOR& vInters)
{
// eseguo
bool bOk = MyLineSurfTmInters( ptP, vtDir, nId, nRefType, vInters) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtLineSurfTmInters({" + ToString( ptP) + "},{" +
ToString( vtDir) + "}," +
ToString( nId) + "," +
RefTypeToString( nRefType) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della prima nuova entit
return bOk ;
}
//-------------------------------------------------------------------------------
static bool
MyLineSurfBzInters( const Point3d& ptP, const Vector3d& vtDir, int nId, int nRefType, INTDBLVECTOR& vInters)
{
vInters.clear() ;
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie Bezier
const ISurfBezier* pSbz = GetSurfBezier( pGeomDB->GetGeoObj( nId)) ;
if ( pSbz == nullptr)
return false ;
// recupero il suo riferimento globale
Frame3d frSurf ;
if ( ! pGeomDB->GetGlobFrame( nId, frSurf))
return false ;
// porto in locale il punto e la direzione della linea
Point3d ptPL = GetPointLocal( pGeomDB, ptP, nRefType, frSurf) ;
Vector3d vtDirL = GetVectorLocal( pGeomDB, vtDir, nRefType, frSurf) ;
vtDirL.Normalize() ;
// calcolo l'ingombro della Bezier
BBox3d b3Surf ;
if ( ! pSbz->GetLocalBBox( b3Surf))
return false ;
// calcolo l'intersezione
double dLen = b3Surf.MaxDistFromPoint( ptPL) ;
ILSBIVECTOR vInfo ;
if ( ! IntersLineSurfBz( ptPL, vtDirL, dLen, pSbz, vInfo, false))
return false ;
//// ciclo sulle intersezioni
//for ( const auto& Info : vInfo) {
// // se intersezione puntuale
// if ( Info.nILTT == ILTT_VERT || Info.nILTT == ILTT_EDGE || Info.nILTT == ILTT_IN) {
// int nFlag = SLT_TOUCH ;
// if ( Info.dCosDN > EPS_ZERO)
// nFlag = SLT_OUT ;
// else if ( Info.dCosDN < -EPS_ZERO)
// nFlag = SLT_IN ;
// vInters.emplace_back( nFlag, Info.dU) ;
// }
// // se altrimenti intersezione con coincidenza
// else if ( Info.nILTT == ILTT_SEGM || Info.nILTT == ILTT_SEGM_ON_EDGE) {
// vInters.emplace_back( SLT_TG_INI, Info.dU) ;
// vInters.emplace_back( SLT_TG_FIN, Info.dU2) ;
// }
//}
//// elimino intersezioni ripetute
//for ( size_t j = 1 ; j < vInters.size() ; ) {
// // intersezione precedente
// size_t i = j - 1 ;
// // se hanno lo stesso parametro
// if ( abs( vInters[i].second - vInters[j].second) < EPS_SMALL) {
// // se sono entrambe entranti o uscenti, elimino la seconda
// if ( ( vInters[i].first == SLT_IN && vInters[j].first == SLT_IN) ||
// ( vInters[i].first == SLT_OUT && vInters[j].first == SLT_OUT)) {
// vInters.erase( vInters.begin() + j) ;
// continue ;
// }
// // se una entrante e l'altra uscente, cambio in touch ed elimino la seconda
// else if ( ( vInters[i].first == SLT_IN && vInters[j].first == SLT_OUT) ||
// ( vInters[i].first == SLT_OUT && vInters[j].first == SLT_IN)) {
// vInters[i].first = SLT_TOUCH ;
// vInters.erase( vInters.begin() + j) ;
// continue ;
// }
// // se una puntuale e l'altra inizio di coincidenza, elimino la prima
// else if ( ( vInters[i].first == SLT_IN || vInters[i].first == SLT_OUT || vInters[i].first == SLT_TOUCH) && vInters[j].first == SLT_TG_INI) {
// vInters.erase( vInters.begin() + i) ;
// continue ;
// }
// // se una fine di coincidenza e l'altra puntuale, elimino la seconda
// else if ( vInters[i].first == SLT_TG_FIN && ( vInters[j].first == SLT_IN || vInters[j].first == SLT_OUT || vInters[j].first == SLT_TOUCH)) {
// vInters.erase( vInters.begin() + j) ;
// continue ;
// }
// // se una fine di coincidenza e l'altra inizio di coincidenza, elimino entrambe
// else if ( i > 0 && vInters[i].first == SLT_TG_FIN && vInters[j].first == SLT_TG_INI) {
// vInters.erase( vInters.begin() + j) ;
// vInters.erase( vInters.begin() + i) ;
// -- j ;
// continue ;
// }
// }
// // passo alla successiva
// ++ j ;
//}
return true ;
}
//-------------------------------------------------------------------------------
bool
ExeLineSurfBzInters( const Point3d& ptP, const Vector3d& vtDir, int nId, int nRefType,
INTDBLVECTOR& vInters)
INTDBLVECTOR& vInters)
{
// eseguo
bool bOk = MyLineSurfBzInters( ptP, vtDir, nId, nRefType, vInters) ;