Include :

- aggiunta definizione costante EPS_TRIA_H = 1e-6 e del suo quadrato
- in Triangle3d aggiunto controllo minima dimensione altezze triangolo EPS_TRIA_H
- definiti nuovi tipi di collezioni.
This commit is contained in:
Dario Sassi
2019-11-23 17:27:11 +00:00
parent dd08440af4
commit fbd52ae401
3 changed files with 29 additions and 12 deletions
+3 -2
View File
@@ -20,8 +20,9 @@
//----------------------------------------------------------------------------
// Raccolte di Point3d
typedef std::vector<Point3d> PNTVECTOR ; // vettore di punti
typedef std::list<Point3d> PNTLIST ; // lista di punti
typedef std::vector<Point3d> PNTVECTOR ; // vettore di punti
typedef std::list<Point3d> PNTLIST ; // lista di punti
typedef std::vector<PNTVECTOR> PNTMATRIX ; // matrice di punti
//----------------------------------------------------------------------------
// Raccolte di coppie Point3d,dU
+5 -3
View File
@@ -1,13 +1,13 @@
//----------------------------------------------------------------------------
// EgalTech 2013-2013
// EgalTech 2013-2019
//----------------------------------------------------------------------------
// File : EgkGeoConst.h Data : 20.11.13 Versione : 1.3a1
// File : EgkGeoConst.h Data : 23.11.19 Versione : 2.1k5
// Contenuto : Costanti generali per calcoli geometrici.
//
//
//
// Modifiche : 04.01.12 DS Creazione modulo.
//
// 23.11.19 DS Aggiunta costante EPS_TRIA_H.
//
//----------------------------------------------------------------------------
@@ -21,10 +21,12 @@ const double ONEINCH = 25.4 ;
// epsilon per lunghezze, versori e parametri
const double EPS_SMALL = 1e-3 ;
const double EPS_TRIA_H = 1e-6 ;
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_TRIA_H = EPS_TRIA_H * EPS_TRIA_H ;
const double SQ_EPS_ZERO = EPS_ZERO * EPS_ZERO ;
// infinito per lunghezze
+21 -7
View File
@@ -51,22 +51,36 @@ class Triangle3d
bool Validate( bool bOverwrite = false)
{ if ( AreSamePointApprox( m_ptP[0], m_ptP[1]) || AreSamePointApprox( m_ptP[0], m_ptP[2]))
return false ;
Vector3d vtV = ( m_ptP[1] - m_ptP[0]) ^ ( m_ptP[2] - m_ptP[0]) ;
vtV.Normalize( EPS_ZERO) ;
Vector3d vtV1 = m_ptP[1] - m_ptP[0] ;
Vector3d vtV2 = m_ptP[2] - m_ptP[1] ;
Vector3d vtN = vtV1 ^ vtV2 ;
double dSqN = vtN.SqLen() ;
if ( dSqN < SQ_EPS_ZERO)
return false ;
if ( dSqN < SQ_EPS_TRIA_H * std::max( { vtV1.SqLen(), vtV2.SqLen(), ( vtV1 + vtV2).SqLen()}))
return false ;
vtN /= sqrt( dSqN) ;
if ( m_vtN.IsSmall() || bOverwrite) {
m_vtN = vtV ;
m_vtN = vtN ;
return true ;
}
return AreSameVectorApprox( vtV, m_vtN) ;
return AreSameVectorApprox( vtN, m_vtN) ;
}
bool IsValid( void) const
{ if ( AreSamePointApprox( m_ptP[0], m_ptP[1]) || AreSamePointApprox( m_ptP[0], m_ptP[2]))
return false ;
if ( m_vtN.IsSmall())
return false ;
Vector3d vtV = ( m_ptP[1] - m_ptP[0]) ^ ( m_ptP[2] - m_ptP[0]) ;
vtV.Normalize( EPS_ZERO) ;
return AreSameVectorApprox( vtV, m_vtN) ;
Vector3d vtV1 = m_ptP[1] - m_ptP[0] ;
Vector3d vtV2 = m_ptP[2] - m_ptP[1] ;
Vector3d vtN = vtV1 ^ vtV2 ;
double dSqN = vtN.SqLen() ;
if ( dSqN < SQ_EPS_ZERO)
return false ;
if ( dSqN < SQ_EPS_TRIA_H * std::max( { vtV1.SqLen(), vtV2.SqLen(), ( vtV1 + vtV2).SqLen()}))
return false ;
vtN /= sqrt( dSqN) ;
return AreSameVectorApprox( vtN, m_vtN) ;
}
void Translate( const Vector3d& vtMove)
{ m_ptP[0].Translate( vtMove) ;