EgtGeomKernel :

- ricalcolo delle facce dopo scalatura per TriMesh
- Rimozione punti allineati nei contatti tra facce diverse.
This commit is contained in:
Riccardo Elitropi
2024-04-12 15:27:52 +02:00
parent fe46b8ebd2
commit 583e30170a
2 changed files with 31 additions and 9 deletions
+2 -6
View File
@@ -3244,7 +3244,6 @@ SurfTriMesh::Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double
bMirror = ( bMirror ? ( dCoeffZ > 0) : ( dCoeffZ < 0)) ;
// aggiorno le facce
bool bRecalc = ( abs( dCoeffX) < EPS_ZERO || abs( dCoeffY) < EPS_ZERO || abs( dCoeffZ) < EPS_ZERO) ;
for ( int i = 0 ; i < GetTriangleSize() ; ++ i) {
if ( m_vTria[i].nIdVert[0] != SVT_DEL) {
// se c'è mirror, devo invertire la faccia
@@ -3254,15 +3253,12 @@ SurfTriMesh::Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double
if ( ! CalcTriangleNormal( i)) {
// elimino il triangolo
RemoveTriangle( i) ;
// richiedo ricalcolo vertici e topologia
bRecalc = true ;
}
}
}
if ( bRecalc)
return DoCompacting() ;
return true ;
return DoCompacting() ;
}
//----------------------------------------------------------------------------
+29 -3
View File
@@ -313,15 +313,41 @@ AdjustLoop( PNTULIST& PointList, double dMaxEdgeLen, bool& bModif)
{
// Ciclo sui punti del loop
auto itLast = PointList.begin() ;
vector<IGeoObj*> VT ;
for ( auto it = next( itLast) ; it != PointList.end() ; ++ it) {
// Se dal punto corrente inizia un segmento adiacente a un'altra faccia
if ( itLast->second != it->second) {
// Elimino i punti interni
// Elimino i punti interni allineati
auto itNextToLast = next( itLast) ;
PolyLine PL ;
int nPar = 0 ;
PL.AddUPoint( nPar, itLast->first) ;
for ( auto itInn = itNextToLast ; itInn != it ; ) {
itInn = PointList.erase( itInn) ;
bModif = true ;
++ nPar ;
PL.AddUPoint( nPar, itInn->first) ;
itInn = next( itInn) ;
}
PL.AddUPoint( nPar + 1, it->first) ;
// se ho almeno 3 punti riferiti alla stessa adiacenza ( quindi 2 edges )
if ( PL.GetPointNbr() > 2) {
PL.RemoveAlignedPoints( 50 * EPS_SMALL) ; // può cambiare...
// aggiorno la lista di punti con i rimanenti
for ( auto itInn = itNextToLast ; itInn != it ; ) {
Point3d ptCurr ;
bool bFound = false ;
if ( PL.GetFirstPoint( ptCurr)) {
bFound = AreSamePointApprox( ptCurr, itInn->first) ;
while ( ! bFound && PL.GetNextPoint( ptCurr))
bFound = AreSamePointApprox( ptCurr, itInn->first) ;
}
if ( ! bFound) {
itInn = PointList.erase( itInn) ;
bModif = true ;
}
else
itInn = next( itInn) ;
}
}
// Se la lunghezza del segmento supera il limite imposto
double dSegLen = Dist( it->first, itLast->first) ;