EgtGeomKernel 1.6x3 :

- modifiche ad archi per gestire raggi grandi e aggiunto controllo raggio massimo
- migliorata Normalize di Vector3d.
This commit is contained in:
Dario Sassi
2016-12-27 09:05:07 +00:00
parent 5d09d963e7
commit 279bfa17f4
4 changed files with 12 additions and 3 deletions
+5 -2
View File
@@ -640,7 +640,8 @@ CurveArc::Save( NgeWriter& ngeOut) const
if ( ! ngeOut.WriteVector( m_VtS, ";"))
return false ;
// angolo al centro
if ( ! ngeOut.WriteDouble( m_dAngCenDeg, ";"))
int nDec = ( m_dRad < 0.1 * BIG_ARC_RAD ? 6 : 9) ;
if ( ! ngeOut.WriteDouble( m_dAngCenDeg, ";", false, nDec))
return false ;
// deltaN
if ( ! ngeOut.WriteDouble( m_dDeltaN, ";", true))
@@ -673,6 +674,7 @@ CurveArc::Load( NgeReader& ngeIn)
// recupero il versore iniziale
if ( ! ngeIn.ReadVector( m_VtS, ";"))
return false ;
m_VtS.Normalize() ; // per garantire la precisione con raggi grandi
// recupero l'angolo al centro
if ( ! ngeIn.ReadDouble( m_dAngCenDeg, ";"))
return false ;
@@ -766,7 +768,8 @@ CurveArc::Validate( void)
// eseguo il controllo
m_nStatus = ( ( m_VtN.IsNormalized() && m_VtS.IsNormalized() &&
AreOrthoApprox( m_VtN, m_VtS) &&
m_dRad > EPS_SMALL && fabs( m_dAngCenDeg) > EPS_ANG_ZERO) ? OK : ERR) ;
m_dRad > EPS_SMALL && m_dRad < MAX_ARC_RAD &&
fabs( m_dAngCenDeg) > EPS_ANG_ZERO) ? OK : ERR) ;
}
return ( m_nStatus == OK) ;
BIN
View File
Binary file not shown.
+6
View File
@@ -37,6 +37,12 @@ const double LIN_TOL_FINE = 0.01 ;
// lunghezza minima feature lineare
const double LIN_FEA_LEN_STD = 20 ;
//----------------- Costanti per archi ---------------------------------------
// raggio oltre il quale un angolo al centro EPS_ANG_ZERO produce spostamento maggiore di EPS_SMALL
const double BIG_ARC_RAD = 500000 ;
// raggio massimo ammesso per un arco
const double MAX_ARC_RAD = 50000000 ;
//----------------- Costanti per archi come curve di Bezier ------------------
// massimo angolo al centro di un arco espresso tramite curva di Bezier
const double BEZARC_ANG_CEN_MAX = 90 ;
+1 -1
View File
@@ -151,7 +151,7 @@ Vector3d::Normalize( double dEps)
{
// se già normalizzato, ok
double dSqLen = x * x + y * y + z * z ;
if ( fabs( 1.0 - dSqLen) < ( 2 * EPS_ZERO))
if ( fabs( 1.0 - dSqLen) < ( 2 * 1000 * DBL_EPSILON))
return true ;
// se troppo piccolo, errore