EgtGeomKernel :

- modifica degli argomenti della funzione CalcRegionPolyLines.
This commit is contained in:
Daniele Bariletti
2024-09-05 12:09:28 +02:00
parent ec6cb79a8d
commit aa2b6ccde5
4 changed files with 35 additions and 29 deletions
+9 -2
View File
@@ -63,7 +63,6 @@ GetSurfBezierByRegion( const CICURVEPVECTOR& vpCurve, double dLinTol)
if ( &vpCurve == nullptr || vpCurve.empty())
return nullptr ;
// calcolo le polilinee che approssimano le curve della regione
POLYLINEVECTOR vPLOrd ;
POLYLINEVECTOR vPL ;
vPL.resize( vpCurve.size()) ;
for ( int i = 0 ; i < int( vpCurve.size()) ; ++ i) {
@@ -73,8 +72,16 @@ GetSurfBezierByRegion( const CICURVEPVECTOR& vpCurve, double dLinTol)
Vector3d vtN ;
INTMATRIX vnPLIndMat ;
BOOLVECTOR vbInvert ;
if ( ! CalcRegionPolyLines( vPL, vPLOrd, vtN, vnPLIndMat,vbInvert))
if ( ! CalcRegionPolyLines( vPL, vtN, vnPLIndMat,vbInvert))
return nullptr ;
POLYLINEVECTOR vPLOrd ;
for ( int i = 0 ; i < int( vnPLIndMat.size()) ; ++i) {
for ( int j = 0 ; j < int( vnPLIndMat[i].size()) ; ++j){
vPLOrd.push_back(vPL[vnPLIndMat[i][j]]) ;
if( vbInvert[vnPLIndMat[i][j]])
vPLOrd.back().Invert() ;
}
}
// creo e setto la superficie di bezier
PtrOwner<SurfBezier> pSbz( CreateBasicSurfBezier()) ;
if ( IsNull( pSbz) || ! pSbz->CreateByRegion( vPLOrd))
+1 -18
View File
@@ -635,7 +635,6 @@ CalcRegionPolyLines( const POLYLINEVECTOR& vPL, POLYLINEVECTOR& vPLOrd, Vector3d
vPL_IndOrder[i] = m_vArea[i].first ;
// aggiungo le diverse curve
vPLOrd = vPL ;
bool bFirstCrv ;
Plane3d plExtLoop ;
double dAreaExtLoop = 0. ;
@@ -655,7 +654,6 @@ CalcRegionPolyLines( const POLYLINEVECTOR& vPL, POLYLINEVECTOR& vPLOrd, Vector3d
dAreaExtLoop = m_vArea[i].second ;
// inverto se necessario
if ( m_vArea[i].second < EPS_SMALL) {
vPLOrd[j].Invert() ;
vCrvCompo[j]->Invert() ;
dAreaExtLoop *= -1 ;
vbInvert[j] = true ;
@@ -691,7 +689,6 @@ CalcRegionPolyLines( const POLYLINEVECTOR& vPL, POLYLINEVECTOR& vPLOrd, Vector3d
m_vArea[i].first = -1 ;
// inverto se necessario
if ( m_vArea[i].second * dAreaExtLoop > 0.) {
vPLOrd[j].Invert() ;
vCrvCompo[j]->Invert() ;
vbInvert[j] = true ;
}
@@ -701,23 +698,9 @@ CalcRegionPolyLines( const POLYLINEVECTOR& vPL, POLYLINEVECTOR& vPLOrd, Vector3d
} while ( ! bFirstCrv) ;
if ( bInvertAll) {
for ( int i = 0 ; i < int( vPLOrd.size()) ; ++i) {
vPLOrd[i].Invert() ;
for ( int i = 0 ; i < int( vPL.size()) ; ++i)
vbInvert[i] = ! vbInvert[i] ;
}
}
//// ordino le PolyLine per area
// POLYLINEVECTOR vPL_tmp ;
// for ( int i = 0 ; i < int( vPL_IndOrder.size()) ; ++ i)
// vPL_tmp.push_back( vPLOrd[ vPL_IndOrder[i]]) ;
//for ( int i = 0 ; i < int( vnPLIndMat.size()) ; ++i) {
// for ( int j = 0 ; j < int( vnPLIndMat[i].size()) ; ++j ) {
// vPL_tmp.push_back( vPLOrd[vnPLIndMat[i][j]]) ;
// }
//}
//swap( vPLOrd, vPL_tmp) ;
return true ;
}
+16 -7
View File
@@ -60,7 +60,6 @@ GetSurfTriMeshByRegion( const CICURVEPVECTOR& vpCurve, double dLinTol)
if ( &vpCurve == nullptr || vpCurve.empty())
return nullptr ;
// calcolo le polilinee che approssimano le curve della regione
POLYLINEVECTOR vPLOrd ;
POLYLINEVECTOR vPL ;
vPL.resize( vpCurve.size()) ;
for ( int i = 0 ; i < int( vpCurve.size()) ; ++ i) {
@@ -70,11 +69,17 @@ GetSurfTriMeshByRegion( const CICURVEPVECTOR& vpCurve, double dLinTol)
Vector3d vtN ;
INTMATRIX vnPLIndMat ;
BOOLVECTOR vbInvert ;
if ( ! CalcRegionPolyLines( vPL, vPLOrd, vtN, vnPLIndMat, vbInvert))
if ( ! CalcRegionPolyLines( vPL, vtN, vnPLIndMat, vbInvert))
return nullptr ;
for ( int i = 0 ; i < int( vnPLIndMat.size()) ; ++i) {
for ( int j = 0 ; j < int( vnPLIndMat[i].size()) ; ++j){
if( vbInvert[vnPLIndMat[i][j]])
vPL[vnPLIndMat[i][j]].Invert() ;
}
}
// creo e setto la superficie trimesh
PtrOwner<SurfTriMesh> pSTM( CreateBasicSurfTriMesh()) ;
if ( IsNull( pSTM) || ! pSTM->CreateByRegion( vPLOrd, vnPLIndMat))
if ( IsNull( pSTM) || ! pSTM->CreateByRegion( vPL, vnPLIndMat))
return nullptr ;
// salvo tolleranza lineare usata
pSTM->SetLinearTolerance( dLinTol) ;
@@ -149,7 +154,6 @@ GetSurfTriMeshByRegionExtrusion( const CICURVEPVECTOR& vpCurve, const Vector3d&
return GetSurfTriMeshByExtrusion( vpCurve[0], vtExtr, true, dLinTol) ;
// calcolo le polilinee che approssimano le curve della regione
POLYLINEVECTOR vPL ;
POLYLINEVECTOR vPLOrd ;
vPL.resize( vpCurve.size()) ;
for ( int i = 0 ; i < int( vpCurve.size()) ; ++ i) {
if ( ! vpCurve[i]->ApproxWithLines( dLinTol, ANG_TOL_STD_DEG, ICurve::APL_SPECIAL, vPL[i]))
@@ -158,8 +162,12 @@ GetSurfTriMeshByRegionExtrusion( const CICURVEPVECTOR& vpCurve, const Vector3d&
Vector3d vtN ;
INTMATRIX vnPLIndMat ;
BOOLVECTOR vbInvert ;
if ( ! CalcRegionPolyLines( vPL, vPLOrd, vtN, vnPLIndMat, vbInvert))
if ( ! CalcRegionPolyLines( vPL, vtN, vnPLIndMat, vbInvert))
return nullptr ;
for ( int i = 0 ; i < int( vPL.size()) ; ++i) {
if( vbInvert[i])
vPL[i].Invert() ;
}
// verifico la direzione di estrusione
double dOrthoExtr = vtN * vtExtr ;
if ( ( abs( dOrthoExtr) < EPS_SMALL))
@@ -167,11 +175,12 @@ GetSurfTriMeshByRegionExtrusion( const CICURVEPVECTOR& vpCurve, const Vector3d&
// se componente estrusione negativa, inverto tutti i percorsi
if ( dOrthoExtr < 0) {
for ( int i = 0 ; i < int( vPL.size()) ; ++ i)
vPLOrd[i].Invert() ;
vPL[i].Invert() ;
}
// creo la prima superficie di estremità
PtrOwner<SurfTriMesh> pSTM( CreateBasicSurfTriMesh()) ;
if ( IsNull( pSTM) || ! pSTM->CreateByRegion( vPLOrd, vnPLIndMat))
// alla funzione CreateByRegion passo anche la matrice che contiene la struttura dei chunk. Le polyline hanno già il verso giusto
if ( IsNull( pSTM) || ! pSTM->CreateByRegion( vPL, vnPLIndMat))
return nullptr ;
// creo la seconda superficie e la unisco alla prima
{ // copio la prima superficie
+9 -2
View File
@@ -245,13 +245,20 @@ Triangulate::MakeAdvanced( const POLYLINEVECTOR& vPLORIG, PNTVECTOR& vPt, INTVEC
INTMATRIX vnPLIndMat ;
BOOLVECTOR vbInvert ;
if( vnPLIndMatPre.size() == 0){
if ( ! CalcRegionPolyLines( vPLORIG, vPL, vtN, vnPLIndMat, vbInvert))
if ( ! CalcRegionPolyLines( vPLORIG, vtN, vnPLIndMat, vbInvert))
return false ;
vPL = vPLORIG ;
for ( int i = 0 ; i < int( vnPLIndMat.size()) ; ++i) {
for ( int j = 0 ; j < int( vnPLIndMat[i].size()) ; ++j){
if( vbInvert[vnPLIndMat[i][j]])
vPL.back().Invert() ;
}
}
}
else {
// ho già calcolato e riordinato tutto, devo solo fare una copia delle polyline
// non serve fare le eventuali inversioni delle polyline, perché se è già stata calcolata la matrice dei chunck allora sono GIà state invertire
vPL = vPLORIG ;
vPL = &vPLORIG ;
vnPLIndMat = vnPLIndMatPre ;
}