EgtGeomKernel 1.6d5 :

- correzioni a scalatura per evitare che le entità collassino in un punto.
This commit is contained in:
Dario Sassi
2015-04-22 06:45:46 +00:00
parent 9379e00f14
commit 1aaf135f2f
6 changed files with 78 additions and 20 deletions
+20 -7
View File
@@ -2140,10 +2140,17 @@ SurfTriMesh::Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double
if ( fabs( dCoeffX) < EPS_ZERO && fabs( dCoeffY) < EPS_ZERO && fabs( dCoeffZ) < EPS_ZERO)
return false ;
// determino se contiene anche un mirror (numero dispari di coefficienti negativi)
bool bMirror = ( dCoeffX < 0) ;
bMirror = ( bMirror ? ( dCoeffY > 0) : ( dCoeffY < 0)) ;
bMirror = ( bMirror ? ( dCoeffZ > 0) : ( dCoeffZ < 0)) ;
// calcolo bbox allineato con riferimento di scalatura e senza tener conto dello spessore
// lo scalo per verificare se tutto si riduce a un punto o una linea (solo se diretta come assi ref)
BBox3d b3Ref ;
if ( ! GetBBox( frRef, b3Ref))
return false ;
Vector3d vtDelta = b3Ref.GetMax() - b3Ref.GetMin() ;
bool bZeroX = ( fabs( vtDelta.x * dCoeffX) < EPS_SMALL) ;
bool bZeroY = ( fabs( vtDelta.y * dCoeffY) < EPS_SMALL) ;
bool bZeroZ = ( fabs( vtDelta.z * dCoeffZ) < EPS_SMALL) ;
if ( ( bZeroX && bZeroY) || ( bZeroX && bZeroZ) || ( bZeroY && bZeroZ))
return false ;
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
@@ -2154,19 +2161,25 @@ SurfTriMesh::Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double
m_vVert[i].ptP.Scale( frRef, dCoeffX, dCoeffY, dCoeffZ) ;
}
// determino se contiene anche un mirror (numero dispari di coefficienti negativi)
bool bMirror = ( dCoeffX < 0) ;
bMirror = ( bMirror ? ( dCoeffY > 0) : ( dCoeffY < 0)) ;
bMirror = ( bMirror ? ( dCoeffZ > 0) : ( dCoeffZ < 0)) ;
// aggiorno le facce
bool bOk = true ;
for ( int i = 0 ; i < GetTriangleSize() ; ++ i) {
if ( m_vTria[i].nIdVert[0] != SVT_DEL) {
// se c'è mirror, devo invertire la faccia
if ( bMirror && ! InvertTriangle( i))
return false ;
bOk = false ;
// aggiorno la normale
if ( ! CalcTriangleNormal( i))
return false ;
bOk = false ;
}
}
return true ;
return bOk ;
}
//----------------------------------------------------------------------------