This commit is contained in:
Daniele Bariletti
2026-05-22 10:41:25 +02:00
2 changed files with 15 additions and 3 deletions
BIN
View File
Binary file not shown.
+15 -3
View File
@@ -3810,12 +3810,19 @@ SurfTriMesh::VerifyConnection( bool bShellsAndParts) const
BBox3d b3Box ;
PtrOwner<ISurfTriMesh> pStmShell ;
} ;
// vettore di shell con vettori dei propri triangoli (per accelerare nei casi degeneri)
INTMATRIX mShellTria( m_nShells) ;
for ( int i = 0 ; i < ssize( m_vTria) ; ++ i) {
if ( m_vTria[i].nShell < m_nShells)
mShellTria[m_vTria[i].nShell].push_back( i) ;
}
// classificazione delle shell
vector<SHELLINFO> vOuterShells ;
vector<SHELLINFO> vInnerShells ;
INTVECTOR vOpenShells ;
for ( int nSh = 0 ; nSh < m_nShells ; ++ nSh) {
// se la shell è chiusa
if ( IsShellClosed( nSh)) {
if ( ssize( mShellTria[nSh]) >= 4 && IsShellClosed( nSh)) {
// creo una superficie clonata dalla shell
PtrOwner<ISurfTriMesh> pStmShell( CloneShell( nSh)) ;
if ( IsNull( pStmShell) || ! pStmShell->IsValid())
@@ -3827,7 +3834,9 @@ SurfTriMesh::VerifyConnection( bool bShellsAndParts) const
BBox3d b3Box ;
pStmShell->GetLocalBBox( b3Box, BBF_STANDARD) ;
// la inserisco nel vettore opportuno
if ( dVol > 0)
if ( abs( dVol) < 1 * 1 * EPS_SMALL)
vOpenShells.push_back( nSh) ;
else if ( dVol > 0)
vOuterShells.emplace_back( nSh, dVol, b3Box, Release( pStmShell)) ;
else
vInnerShells.emplace_back( nSh, dVol, b3Box, Release( pStmShell)) ;
@@ -3979,6 +3988,7 @@ SurfTriMesh::IsShellClosed( int nShell) const
return false ;
// ciclo sui triangoli della shell
bool bClosed = true ;
int nTriaCnt = 0 ;
for ( int i = 0 ; i < GetTriangleSize() ; ++ i) {
// se triangolo non cancellato e della shell
if ( m_vTria[i].nIdVert[0] != SVT_DEL && m_vTria[i].nShell == nShell) {
@@ -3989,10 +3999,12 @@ SurfTriMesh::IsShellClosed( int nShell) const
bClosed = false ;
break ;
}
else
++ nTriaCnt ;
}
}
// restituisco il risultato
return bClosed ;
return ( bClosed && nTriaCnt >= 4) ;
}
//----------------------------------------------------------------------------