EgtGeomKernel :

- spostato il filtro delle intersezioni Line-SupBez da executor a GeomKernel.
This commit is contained in:
Daniele Bariletti
2024-02-28 10:30:49 +01:00
parent 8d2ae598e5
commit 7a2af0b5f2
2 changed files with 65 additions and 52 deletions
+64 -8
View File
@@ -186,18 +186,74 @@ IntersLineSurfBz( const Point3d& ptL, const Vector3d& vtL, double dLen, const IS
pSurfBz->GetPointNrmD1D2( ptSP2.x / SBZ_TREG_COEFF, ptSP2.y / SBZ_TREG_COEFF, ISurfBezier::FROM_MINUS, ISurfBezier::FROM_MINUS, ptIBz2, vtN) ;
dCos2 = vtN * vtL ;
}
//IntLinSbzInfo InfoBz( InfoTm.nILTT, dUU, dUU2, InfoTm.nT, dCos, ptIBz, ptIBz2, ptSP, ptSP2) ;
//vInfo.emplace_back( InfoBz) ;
UpdateInfoIntersLineSurfBz( ptL, vtL, InfoTm.nILTT, InfoTm.nT, ptSP, ptIBz, dCos, ptSP2, ptIBz2, dCos2, vInfo) ;
}
OrderInfoIntersLineSurfBz( vInfo) ;
//////////////////////////////////////////////////////// interlineSurfTm
//UpdateInfoIntersLineSurfTm( ptL, vtDir, dLen, nT, Tria, vInfo, bFinite) ;
// OrderInfoIntersLineSurfTm( vInfo) ;
//////////////////////////////////////////////////////// interlineSurfTm
return true ;
}
//----------------------------------------------------------------------------
bool
FilterLineSurfBzInters( const ILSBIVECTOR& vInfo, INTDBLVECTOR& vInters)
{
// tengo per buone la classificazione delle intersezioni fatte sulla trimesh
// 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 = LSBT_TOUCH ;
if ( Info.dCosDN > EPS_ZERO)
nFlag = LSBT_OUT ;
else if ( Info.dCosDN < -EPS_ZERO)
nFlag = LSBT_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( LSBT_TG_INI, Info.dU) ;
vInters.emplace_back( LSBT_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 == LSBT_IN && vInters[j].first == LSBT_IN) ||
( vInters[i].first == LSBT_OUT && vInters[j].first == LSBT_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 == LSBT_IN && vInters[j].first == LSBT_OUT) ||
( vInters[i].first == LSBT_OUT && vInters[j].first == LSBT_IN)) {
vInters[i].first = LSBT_TOUCH ;
vInters.erase( vInters.begin() + j) ;
continue ;
}
// se una puntuale e l'altra inizio di coincidenza, elimino la prima
else if ( ( vInters[i].first == LSBT_IN || vInters[i].first == LSBT_OUT || vInters[i].first == LSBT_TOUCH) && vInters[j].first == LSBT_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 == LSBT_TG_FIN && ( vInters[j].first == LSBT_IN || vInters[j].first == LSBT_OUT || vInters[j].first == LSBT_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 == LSBT_TG_FIN && vInters[j].first == LSBT_TG_INI) {
vInters.erase( vInters.begin() + j) ;
vInters.erase( vInters.begin() + i) ;
-- j ;
continue ;
}
}
// passo alla successiva
++ j ;
}
}
+1 -44
View File
@@ -35,7 +35,6 @@
#include "/EgtDev/Include/EGkDistPointSurfTm.h"
#include "/EgtDev/Extern/Eigen/Dense"
#include "/EgtDev/Include/EGkCurveComposite.h"
#include "/EgtDev/Include/EGkGeoObjSave.h"
#include <limits>
using namespace std ;
@@ -1748,13 +1747,6 @@ SurfBezier::Cut( const Plane3d& plPlane, bool bSaveOnEq)
Point3d ptNear = ( vBPnt.empty() ? ORIG : vBPnt[0].first) ;
INTVECTOR vId ;
// debug/////////////////////////////////////////////////////////
//vector<IGeoObj*> vGeoObj ;
//vGeoObj.push_back( static_cast<IGeoObj*>(vCCEdge[1])) ;
//vGeoObj.push_back( static_cast<IGeoObj*>(vCCEdge[3])) ;
//SaveGeoObj( vGeoObj, "D:\\Temp\\inters\\sphere_3d_edges.nge") ;
// debug/////////////////////////////////////////////////////////
// separo tra loop chiusi, interni allo spazio parametrico e loop passanti che tagliano lo spazio intersecando i bordi
ICRVCOMPOPOVECTOR vpCCOpen ;
ICRVCOMPOPOVECTOR vpCCClosed ;
@@ -1834,12 +1826,7 @@ SurfBezier::Cut( const Plane3d& plPlane, bool bSaveOnEq)
}
AddCurveCompoToCuts( pCrvCompo, vpCCOpen, vpCCClosed) ;
}
////debug
//vector<IGeoObj*> vGeoObj ;
//for ( int i = 0 ; i < int(vpCCOpen.size()); ++i )
// vGeoObj.emplace_back(static_cast<IGeoObj*>( vpCCOpen[i]->Clone())) ;
//SaveGeoObj( vGeoObj, "D:\\Temp\\inters\\sphere_openCuts_beforeJoint.nge") ;
////debug
if ( int( vpCCOpen.size()) != 0) {
// devo verificare se devo giuntare la prima curva aperta con l'ultima
Point3d ptStartOpen, ptEndOpen ;
@@ -1851,12 +1838,6 @@ SurfBezier::Cut( const Plane3d& plPlane, bool bSaveOnEq)
vpCCOpen.erase( vpCCOpen.begin()) ;
}
}
////debug
//vector<IGeoObj*> vGeoObj2 ;
//for ( int i = 0 ; i < int(vpCCOpen.size()); ++i )
// vGeoObj2.emplace_back(static_cast<IGeoObj*>( vpCCOpen[i]->Clone())) ;
//SaveGeoObj( vGeoObj2, "D:\\Temp\\inters\\sphere_openCuts_AfterJoint.nge") ;
////debug
//comincio a creare la superficie aggiungendo i tagli aperti ai bordi attualmente esistenti
SurfFlatRegionByContours sfrContour ;
@@ -1870,15 +1851,6 @@ SurfBezier::Cut( const Plane3d& plPlane, bool bSaveOnEq)
pNewTrim.Set( GetTrimRegion()->Clone()) ;
else
pNewTrim.Set( GetSurfFlatRegionRectangle( SBZ_TREG_COEFF * m_nSpanU, SBZ_TREG_COEFF * m_nSpanV)) ;
////debug
//PtrOwner<ISurfFlatRegion> pSrfCopy( pNewTrim->Clone()) ;
//SaveGeoObj( Release(pSrfCopy), "D:\\Temp\\inters\\sphere_actualTrimRegion.nge") ;
////debug
////debug
//PtrOwner<ICurve> pCrvCopy( pNewTrim->GetLoop(0,0)) ;
//SaveGeoObj( Release(pCrvCopy), "D:\\Temp\\inters\\sphere_actualTrimRegionEdge.nge") ;
////debug
for ( int c = 0 ; c < pNewTrim->GetChunkCount() ; ++c) {
for ( int l = 0 ; l < pNewTrim->GetLoopCount( c) ; ++l) {
@@ -2088,11 +2060,6 @@ SurfBezier::Cut( const Plane3d& plPlane, bool bSaveOnEq)
}
}
////debug
//PtrOwner<ISurfFlatRegion> pSrfFR_Copy0( pSFR->Clone()) ;
//SaveGeoObj( Release(pSrfFR_Copy0), "D:\\Temp\\inters\\failed_flip.nge", GDB_SV_BIN) ;
////debug
// aggiorno la superficie di trim
Point3d ptStart ;
Vector3d vtDir, vtDirS, vtDirE ;
@@ -2135,11 +2102,6 @@ SurfBezier::Cut( const Plane3d& plPlane, bool bSaveOnEq)
// 1. se il punto è sopra il piano ed era dentro una curva CCW
// 2. se il punto è sotto il piano ed era interno ad una curva CW
////debug
//PtrOwner<ISurfFlatRegion> pSrfFR_Copy( pSFR->Clone()) ;
//SaveGeoObj( Release(pSrfFR_Copy), "D:\\Temp\\inters\\failed_trim.nge", GDB_SV_BIN) ;
////debug
// la SetTrimRegion controlla se avevo trim precedenti ed eventualmente fa l'intersezione con lo spazio esistente
if ( ( dDist > 0 && bPos) || ( dDist < 0 && ! bPos)) {
if ( ! SetTrimRegion( *pSFR, false) || ! m_pTrimReg->IsValid())
@@ -2152,11 +2114,6 @@ SurfBezier::Cut( const Plane3d& plPlane, bool bSaveOnEq)
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
////debug
//PtrOwner<ISurfFlatRegion> pSrfFR_Copy3( GetTrimRegion()->Clone()) ;
//SaveGeoObj( Release(pSrfFR_Copy3), "D:\\Temp\\inters\\trimmed_paramSpace.nge", GDB_SV_BIN) ;
////debug
return true ;
}