EgtGeomKernel 1.6b3 :
- aggiunta gestione buchi alle triangolazione di poligoni - creazione suerfici trimesh da regioni con buchi.
This commit is contained in:
+46
-2
@@ -146,7 +146,7 @@ PointGrid3d::InsertPoint( const Point3d& ptP, int nId)
|
||||
{
|
||||
// inserimento nel map
|
||||
int nKey = PointHash( Get1dCellNbr( ptP.x), Get1dCellNbr( ptP.y), Get1dCellNbr( ptP.z)) ;
|
||||
m_MMap.insert( make_pair( nKey, make_pair( ptP, nId))) ;
|
||||
m_MMap.emplace( nKey, make_pair( ptP, nId)) ;
|
||||
// aggiornamento del bbox complessivo
|
||||
m_BBox.Add( ptP) ;
|
||||
return true ;
|
||||
@@ -198,6 +198,32 @@ PointGrid3d::Find( const Point3d& ptTest, double dTol, INTVECTOR& vnIds)
|
||||
return ( vnIds.size() > 0) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
PointGrid3d::Find( const BBox3d& b3Test, INTVECTOR& vnIds)
|
||||
{
|
||||
// pulisco il risultato
|
||||
vnIds.clear() ;
|
||||
// determino il range di celle sui tre assi
|
||||
IBox iBox ;
|
||||
if ( ! Get3dRangeNbr( b3Test, iBox))
|
||||
return false ;
|
||||
// ciclo su tutte le celle del range
|
||||
for ( int i = iBox.nXmin ; i <= iBox.nXmax ; ++ i) {
|
||||
for ( int j = iBox.nYmin ; j <= iBox.nYmax ; ++ j) {
|
||||
for ( int k = iBox.nZmin ; k <= iBox.nZmax ; ++ k) {
|
||||
IPNTI_UMMAP_CRANGE MMrange = m_MMap.equal_range( PointHash( i, j, k)) ;
|
||||
for ( ; MMrange.first != MMrange.second ; ++ MMrange.first) {
|
||||
if ( b3Test.Encloses( (*MMrange.first).second.first))
|
||||
vnIds.push_back( (*MMrange.first).second.second) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ( vnIds.size() > 0) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
PointGrid3d::Find( const Point3d& ptTest, double dTol, int& nId)
|
||||
@@ -315,6 +341,24 @@ PointGrid3d::Get1dCellNbr( double dCoord)
|
||||
return static_cast<int>( floor( dCoord * m_dInvCellDim)) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
PointGrid3d::Get3dRangeNbr( const BBox3d& b3Test, IBox& iBox)
|
||||
{
|
||||
// calcolo intersezione tra box
|
||||
BBox3d b3Int ;
|
||||
if ( ! m_BBox.FindIntersection( b3Test, b3Int))
|
||||
return false ;
|
||||
// ricavo gli indici sui tre assi degli estremi del box
|
||||
iBox.nXmin = Get1dCellNbr( b3Int.GetMin().x) ;
|
||||
iBox.nYmin = Get1dCellNbr( b3Int.GetMin().y) ;
|
||||
iBox.nZmin = Get1dCellNbr( b3Int.GetMin().z) ;
|
||||
iBox.nXmax = Get1dCellNbr( b3Int.GetMax().x) ;
|
||||
iBox.nYmax = Get1dCellNbr( b3Int.GetMax().y) ;
|
||||
iBox.nZmax = Get1dCellNbr( b3Int.GetMax().z) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
PointGrid3d::Get3dRangeNbr( const Point3d& ptTest, double dTol, IBox& iBox)
|
||||
@@ -337,5 +381,5 @@ PointGrid3d::Get3dRangeNbr( const Point3d& ptTest, double dTol, IBox& iBox)
|
||||
int
|
||||
PointGrid3d::PointHash( int nX, int nY, int nZ)
|
||||
{
|
||||
return ( nX * 73856093 ^ nY * 19349663 ^ nZ * 83492791) ;
|
||||
return ( nX * 73856093 ^ nY * 19349653 ^ nZ * 83492791) ;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user