Include :

- aggiornamenti.
This commit is contained in:
Dario Sassi
2016-11-14 06:23:46 +00:00
parent dd8a15aa77
commit 30f39cd5b8
4 changed files with 18 additions and 10 deletions
+2
View File
@@ -24,6 +24,8 @@ const double EPS_SMALL = 1e-3 ;
const double EPS_ZERO = 1e-8 ;
const double EPS_PARAM = 1e-8 ;
const double SPAN_PARAM = 1.0 ; // intervallo di curva o superficie semplici
const double SQ_EPS_SMALL = EPS_SMALL * EPS_SMALL ;
const double SQ_EPS_ZERO = EPS_ZERO * EPS_ZERO ;
// infinito per lunghezze
const double INFINITO = 1e10 ;
+6 -6
View File
@@ -44,10 +44,10 @@ class EGK_EXPORT Point3d
public :
//! Verifica se il punto è quasi l'origine
bool IsSmall( void) const
{ return ( ( x * x + y * y + z * z) < ( EPS_SMALL * EPS_SMALL)) ; }
{ return ( ( x * x + y * y + z * z) < SQ_EPS_SMALL) ; }
//! Verifica se il punto è esattamente l'origine
bool IsZero( void) const
{ return ( ( x * x + y * y + z * z) < ( EPS_ZERO * EPS_ZERO)) ; }
{ return ( ( x * x + y * y + z * z) < SQ_EPS_ZERO) ; }
//! Somma sul posto con un vettore
Point3d& operator +=( const Vector3d& vtV)
{ this->x += vtV.x ; this->y += vtV.y ; this->z += vtV.z ; return *this ; }
@@ -335,7 +335,7 @@ AreSamePointXYEpsilon( const Point3d& ptP1, const Point3d& ptP2, double dToler)
inline bool
AreSamePointApprox( const Point3d& ptP1, const Point3d& ptP2)
{
return ( SqDist( ptP1, ptP2) < ( EPS_SMALL * EPS_SMALL)) ;
return ( SqDist( ptP1, ptP2) < SQ_EPS_SMALL) ;
}
//----------------------------------------------------------------------------
@@ -344,7 +344,7 @@ AreSamePointApprox( const Point3d& ptP1, const Point3d& ptP2)
inline bool
AreSamePointXYApprox( const Point3d& ptP1, const Point3d& ptP2)
{
return ( SqDistXY( ptP1, ptP2) < ( EPS_SMALL * EPS_SMALL)) ;
return ( SqDistXY( ptP1, ptP2) < SQ_EPS_SMALL) ;
}
//----------------------------------------------------------------------------
@@ -353,7 +353,7 @@ AreSamePointXYApprox( const Point3d& ptP1, const Point3d& ptP2)
inline bool
AreSamePointExact( const Point3d& ptP1, const Point3d& ptP2)
{
return ( SqDist( ptP1, ptP2) < ( EPS_ZERO * EPS_ZERO)) ;
return ( SqDist( ptP1, ptP2) < SQ_EPS_ZERO) ;
}
//----------------------------------------------------------------------------
@@ -362,5 +362,5 @@ AreSamePointExact( const Point3d& ptP1, const Point3d& ptP2)
inline bool
AreSamePointXYExact( const Point3d& ptP1, const Point3d& ptP2)
{
return ( SqDistXY( ptP1, ptP2) < ( EPS_ZERO * EPS_ZERO)) ;
return ( SqDistXY( ptP1, ptP2) < SQ_EPS_ZERO) ;
}
+2 -2
View File
@@ -71,7 +71,7 @@ class Triangle3d
double dSqDistB = SqDist( ptP[1], ptP[2]) ;
double dSqDistC = SqDist( ptP[2], ptP[0]) ;
double dTwoArea = (( ptP[1] - ptP[0]) ^ ( ptP[2] - ptP[0])).Len() ;
if ( dTwoArea < EPS_SMALL * EPS_SMALL)
if ( dTwoArea < SQ_EPS_SMALL)
return INFINITO ;
else
return ( (std::max)( dSqDistA, (std::max)( dSqDistB, dSqDistC)) / dTwoArea) ;
@@ -179,7 +179,7 @@ BarycentricCoord( const Point3d& ptP, const Triangle3d& Tria,
return false ;
// verifico che l'area (doppia) non sia nulla
double d2Area = TwoAreaInPlane( nPlane, Tria.GetP( 0), Tria.GetP( 1), Tria.GetP( 2)) ;
if ( fabs( d2Area) < EPS_SMALL * EPS_SMALL)
if ( fabs( d2Area) < SQ_EPS_SMALL)
return false ;
// calcolo delle coordinate baricentriche
double dDenom = 1 / d2Area ;
+8 -2
View File
@@ -55,10 +55,16 @@ class EGK_EXPORT Vector3d
double LenXY( void) const ;
//! Verifica se il vettore è quasi nullo
bool IsSmall( void) const
{ return ( ( x * x + y * y + z * z) < ( EPS_SMALL * EPS_SMALL)) ; }
{ return ( ( x * x + y * y + z * z) < SQ_EPS_SMALL) ; }
//! Verifica se il vettore è esattamente nullo
bool IsZero( void) const
{ return ( ( x * x + y * y + z * z) < ( EPS_ZERO * EPS_ZERO)) ; }
{ return ( ( x * x + y * y + z * z) < SQ_EPS_ZERO) ; }
//! Verifica se il vettore è quasi nullo nel piano XY
bool IsSmallXY( void) const
{ return ( ( x * x + y * y) < SQ_EPS_SMALL) ; }
//! Verifica se il vettore è esattamente nullo nel piano XY
bool IsZeroXY( void) const
{ return ( ( x * x + y * y) < SQ_EPS_ZERO) ; }
//! Verifica se il vettore è normalizzato (è un versore)
bool IsNormalized( void) const
{ return ( fabs( 1.0 - (x * x + y * y + z * z)) < ( 2 * EPS_ZERO)) ; }