EgtGeomKernel 2.1.10.1 :

- nuova versione delle operazioni booleane sulle superfici trimesh.
This commit is contained in:
Dario Sassi
2019-10-02 06:27:18 +00:00
parent 8f5ce2ac09
commit a4609dfa0f
8 changed files with 1751 additions and 498 deletions
BIN
View File
Binary file not shown.
+138 -77
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2013-2014
// EgalTech 2013-2019
//----------------------------------------------------------------------------
// File : GdbExecutor.cpp Data : 24.04.14 Versione : 1.5a6
// File : GdbExecutor.cpp Data : 01.10.19 Versione : 2.1i3
// Contenuto : Implementazione della classe GdbExecutor.
//
//
@@ -2177,6 +2177,15 @@ GdbExecutor::ExecuteSurfTriMesh( const string& sCmd2, const STRVECTOR& vsParams)
else if ( sCmd2 == "GENCUT") {
return SurfTrimeshGenCut( vsParams) ;
}
else if ( sCmd2 == "ADD") {
return SurfTrimeshAdd( vsParams) ;
}
else if ( sCmd2 == "INTERS") {
return SurfTrimeshInters( vsParams) ;
}
else if ( sCmd2 == "SUBTRACT") {
return SurfTrimeshSubtract( vsParams) ;
}
else
return false ;
}
@@ -2669,6 +2678,58 @@ GdbExecutor::SurfTrimeshGenCut( const STRVECTOR& vsParams)
return pStmF->GeneralizedCut( *pCurve, true) ;
}
//----------------------------------------------------------------------------
bool
GdbExecutor::SurfTrimeshAdd( const STRVECTOR& vsParams)
{
// Parametri: nSurfId, nOtherSurfId
if ( vsParams.size() != 2)
return false ;
// Recupero Id superficie
int nIdSurf = GetIdParam( vsParams[0]) ;
ISurfTriMesh* pStmM = GetSurfTriMesh( m_pGDB->GetGeoObj( nIdSurf)) ;
SurfTriMesh* pStmF = static_cast <SurfTriMesh*> ( pStmM) ;
int nIdOtherSurf = GetIdParam( vsParams[1]) ;
ISurfTriMesh* pStmOtherM = GetSurfTriMesh( m_pGDB->GetGeoObj( nIdOtherSurf)) ;
SurfTriMesh* pStmOtherF = static_cast <SurfTriMesh*> ( pStmOtherM) ;
return pStmF->Add( *pStmOtherF) ;
}
//----------------------------------------------------------------------------
bool
GdbExecutor::SurfTrimeshInters( const STRVECTOR& vsParams)
{
// Parametri: nSurfId, nOtherSurfId
if ( vsParams.size() != 2)
return false ;
// Recupero Id superficie
int nIdSurf = GetIdParam( vsParams[0]) ;
ISurfTriMesh* pStmM = GetSurfTriMesh( m_pGDB->GetGeoObj( nIdSurf)) ;
SurfTriMesh* pStmF = static_cast <SurfTriMesh*> ( pStmM) ;
int nIdOtherSurf = GetIdParam( vsParams[1]) ;
ISurfTriMesh* pStmOtherM = GetSurfTriMesh( m_pGDB->GetGeoObj( nIdOtherSurf)) ;
SurfTriMesh* pStmOtherF = static_cast <SurfTriMesh*> ( pStmOtherM) ;
return pStmF->Intersect( *pStmOtherF) ;
}
//----------------------------------------------------------------------------
bool
GdbExecutor::SurfTrimeshSubtract( const STRVECTOR& vsParams)
{
// Parametri: nSurfId, nOtherSurfId
if ( vsParams.size() != 2)
return false ;
// Recupero Id superficie
int nIdSurf = GetIdParam( vsParams[0]) ;
ISurfTriMesh* pStmM = GetSurfTriMesh( m_pGDB->GetGeoObj( nIdSurf)) ;
SurfTriMesh* pStmF = static_cast <SurfTriMesh*> ( pStmM) ;
int nIdOtherSurf = GetIdParam( vsParams[1]) ;
SurfTriMesh* pStmOther = GetBasicSurfTriMesh( m_pGDB->GetGeoObj( nIdOtherSurf)) ;
if ( pStmOther == nullptr)
return false ;
return pStmF->Subtract( *pStmOther) ;
}
//----------------------------------------------------------------------------
bool
GdbExecutor::ExecuteVolZmap( const string& sCmd2, const STRVECTOR& vsParams)
@@ -2705,15 +2766,15 @@ GdbExecutor::ExecuteVolZmap( const string& sCmd2, const STRVECTOR& vsParams)
//else if ( sCmd2 == "TRIMESHZMAP") {
// return VolZmapCreateFromTriMesh( vsParams) ;
//}
if ( sCmd2 == "CUT") {
return ExecuteVolZmapCut( vsParams) ;
}
else if ( sCmd2 == "COMP") {
return ExecuteVolZmapCompact( vsParams) ;
}
else if ( sCmd2 == "EDGES") {
return ExecuteVolZmapEdges( vsParams) ;
}
//if ( sCmd2 == "CUT") {
// return ExecuteVolZmapCut( vsParams) ;
//}
//else if ( sCmd2 == "COMP") {
// return ExecuteVolZmapCompact( vsParams) ;
//}
//else if ( sCmd2 == "EDGES") {
// return ExecuteVolZmapEdges( vsParams) ;
//}
return false ;
}
/*
@@ -3024,76 +3085,76 @@ GdbExecutor::VolZmapBBoxZmapIntersection( const STRVECTOR& vsParams)
}*/
//----------------------------------------------------------------------------
bool
GdbExecutor::ExecuteVolZmapCut( const STRVECTOR& vsParams)
{
// Parametri : ZmapId, ParentId, ptP, vtN
if ( vsParams.size() != 4)
return false ;
// Recupero Zmap
int nZmapId = GetIdParam( vsParams[0]) ;
VolZmap* pZmap = GetBasicVolZmap( m_pGDB->GetGeoObj( nZmapId)) ;
if ( pZmap == nullptr)
return false ;
// recupero il riferimento in cui è immerso lo Zmap
Frame3d frRef ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
return false ;
// Recupero punto piano
Point3d ptP ;
if ( ! GetPointParam( vsParams[2], frRef, ptP))
return false ;
// primo vettore frBBoxFrame
Vector3d vtN ;
if ( ! GetVectorParam( vsParams[3], frRef, vtN))
return false ;
vtN.Normalize() ;
Plane3d plPlane ;
plPlane.Set( ptP, vtN) ;
pZmap->Cut( plPlane) ;
return true ;
}
//bool
//GdbExecutor::ExecuteVolZmapCut( const STRVECTOR& vsParams)
//{
// // Parametri : ZmapId, ParentId, ptP, vtN
// if ( vsParams.size() != 4)
// return false ;
// // Recupero Zmap
// int nZmapId = GetIdParam( vsParams[0]) ;
// VolZmap* pZmap = GetBasicVolZmap( m_pGDB->GetGeoObj( nZmapId)) ;
// if ( pZmap == nullptr)
// return false ;
// // recupero il riferimento in cui è immerso lo Zmap
// Frame3d frRef ;
// if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
// return false ;
// // Recupero punto piano
// Point3d ptP ;
// if ( ! GetPointParam( vsParams[2], frRef, ptP))
// return false ;
// // primo vettore frBBoxFrame
// Vector3d vtN ;
// if ( ! GetVectorParam( vsParams[3], frRef, vtN))
// return false ;
// vtN.Normalize() ;
// Plane3d plPlane ;
// plPlane.Set( ptP, vtN) ;
// pZmap->Cut( plPlane) ;
// return true ;
//}
//----------------------------------------------------------------------------
bool
GdbExecutor::ExecuteVolZmapCompact( const STRVECTOR& vsParams)
{
// Parametri : ZmapId
if ( vsParams.size() != 1)
return false ;
// Recupero Zmap
int nZmapId = GetIdParam( vsParams[0]) ;
VolZmap* pZmap = GetBasicVolZmap( m_pGDB->GetGeoObj( nZmapId)) ;
if ( pZmap == nullptr)
return false ;
pZmap->Compact() ;
return true ;
}
//bool
//GdbExecutor::ExecuteVolZmapCompact( const STRVECTOR& vsParams)
//{
// // Parametri : ZmapId
// if ( vsParams.size() != 1)
// return false ;
// // Recupero Zmap
// int nZmapId = GetIdParam( vsParams[0]) ;
// VolZmap* pZmap = GetBasicVolZmap( m_pGDB->GetGeoObj( nZmapId)) ;
// if ( pZmap == nullptr)
// return false ;
// pZmap->Compact() ;
// return true ;
//}
//----------------------------------------------------------------------------
bool
GdbExecutor::ExecuteVolZmapEdges(const STRVECTOR& vsParams)
{
// Parametri : ZmapId, ParentId
if ( vsParams.size() != 2)
return false ;
// Recupero Zmap
int nZmapId = GetIdParam( vsParams[0]) ;
VolZmap* pZmap = GetBasicVolZmap( m_pGDB->GetGeoObj( nZmapId)) ;
if ( pZmap == nullptr)
return false;
// recupero il riferimento in cui è immerso lo Zmap
Frame3d frRef ;
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
return false ;
ICURVEPOVECTOR vpLoop ;
pZmap->GetEdges( vpLoop) ;
bool bOk = true ;
for ( int n = 0 ; n < int( vpLoop.size()) && bOk ; ++ n) {
bOk = bOk && AddGeoObj( "$NN", vsParams[1], Release( vpLoop[n])) ;
}
return bOk ;
}
//bool
//GdbExecutor::ExecuteVolZmapEdges(const STRVECTOR& vsParams)
//{
// // Parametri : ZmapId, ParentId
// if ( vsParams.size() != 2)
// return false ;
// // Recupero Zmap
// int nZmapId = GetIdParam( vsParams[0]) ;
// VolZmap* pZmap = GetBasicVolZmap( m_pGDB->GetGeoObj( nZmapId)) ;
// if ( pZmap == nullptr)
// return false;
// // recupero il riferimento in cui è immerso lo Zmap
// Frame3d frRef ;
// if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
// return false ;
// ICURVEPOVECTOR vpLoop ;
// pZmap->GetEdges( vpLoop) ;
// bool bOk = true ;
// for ( int n = 0 ; n < int( vpLoop.size()) && bOk ; ++ n) {
// bOk = bOk && AddGeoObj( "$NN", vsParams[1], Release( vpLoop[n])) ;
// }
// return bOk ;
//}
//----------------------------------------------------------------------------
bool
+8 -5
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2013-2013
// EgalTech 2013-2019
//----------------------------------------------------------------------------
// File : GdbExecutor.h Data : 25.11.13 Versione : 1.3a1
// File : GdbExecutor.h Data : 01.10.19 Versione : 2.1i3
// Contenuto : Dichiarazione della classe GdbExecutor.
//
//
@@ -118,6 +118,9 @@ class GdbExecutor : public IGdbExecutor
bool SurfTrimeshRemovePart( const STRVECTOR& vsParams) ;
bool SurfTrimeshClonePart( const STRVECTOR& vsParams) ;
bool SurfTrimeshGenCut( const STRVECTOR& vsParams) ;
bool SurfTrimeshAdd( const STRVECTOR& vsParams) ;
bool SurfTrimeshInters( const STRVECTOR& vsParams) ;
bool SurfTrimeshSubtract( const STRVECTOR& vsParams) ;
bool ExecuteVolZmap( const std::string& sCmd2, const STRVECTOR& vsParams) ;
//bool VolZmapCreate( const STRVECTOR& vsParams) ;
//bool VolZmapCreateFromFlatRegion( const STRVECTOR& vsParams) ;
@@ -127,9 +130,9 @@ class GdbExecutor : public IGdbExecutor
//bool VolZmapSetGenTool( const STRVECTOR& vsParams) ;
//bool VolZmapDeepnessMeasure( const STRVECTOR& vsParams) ;
//bool VolZmapBBoxZmapIntersection( const STRVECTOR& vsParams) ;
bool ExecuteVolZmapCut( const STRVECTOR& vsParams) ;
bool ExecuteVolZmapCompact( const STRVECTOR& vsParams) ;
bool ExecuteVolZmapEdges( const STRVECTOR& vsParams) ;
//bool ExecuteVolZmapCut( const STRVECTOR& vsParams) ;
//bool ExecuteVolZmapCompact( const STRVECTOR& vsParams) ;
//bool ExecuteVolZmapEdges( const STRVECTOR& vsParams) ;
bool ExecuteIntersection( const std::string& sCmd2, const STRVECTOR& vsParams) ;
bool LineDiscInters( const STRVECTOR& vsParams) ;
bool RayDiscInters( const STRVECTOR& vsParams) ;
+10 -17
View File
@@ -25,6 +25,14 @@
using namespace std ;
//----------------------------------------------------------------------------
int nTriaTriaIntersCases[6][6] = { { ITTTS_NO, ITTTS_NO, ITTTS_NO, ITTTS_NO, ITTTS_NO, ITTTS_NO },
{ ITTTS_NO, ITTTS_INT_INT_SEG, ITTTS_INT_EDGE, ITTTS_NO, ITTTS_NO, ITTTS_NO },
{ ITTTS_NO, ITTTS_EDGE_INT, ITTTS_EDGE_EDGE_SEG, ITTTS_NO, ITTTS_NO, ITTTS_NO },
{ ITTTS_NO, ITTTS_NO, ITTTS_NO, ITTTS_VERT_VERT, ITTTS_VERT_EDGE, ITTTS_VERT_INT },
{ ITTTS_NO, ITTTS_NO, ITTTS_NO, ITTTS_EDGE_VERT, ITTTS_EDGE_EDGE_PNT, ITTTS_NO },
{ ITTTS_NO, ITTTS_NO, ITTTS_NO, ITTTS_INT_VERT, ITTTS_NO, ITTTS_NO } } ;
//----------------------------------------------------------------------------
static int IntersCoplanarTriaTria( const Triangle3d& trTria1, const Triangle3d& trTria2, TRIA3DVECTOR& vTria) ;
@@ -81,15 +89,6 @@ IntersTriaTria( const Triangle3d& trTria1, const Triangle3d& trTria2, Point3d& p
// limito la linea di intersezione con il primo triangolo
int nRes1 = IntersCoplanarLineTria( ptL1, vtL1, 100.0, trTria1, ptInt, ptInt2, false) ;
switch ( nRes1) {
case ILTT_SEGM :
case ILTT_SEGM_ON_EDGE :
break ;
case ILTT_VERT :
return ( PointInTria( ptInt, trTria2) ? ITTT_VERT : ITTT_NO) ;
default :
return ITTT_NO ;
}
// il segmento calcolato va limitato col secondo triangolo
Point3d ptL2 = ptInt ;
@@ -97,14 +96,8 @@ IntersTriaTria( const Triangle3d& trTria1, const Triangle3d& trTria2, Point3d& p
double dLen = vtL2.Len() ;
vtL2 /= dLen ;
int nRes2 = IntersCoplanarLineTria( ptL2, vtL2, dLen, trTria2, ptInt, ptInt2, true) ;
switch( nRes2) {
case ILTT_NO : return ITTT_NO ;
case ILTT_SEGM : return ITTT_YES ;
case ILTT_SEGM_ON_EDGE : return ITTT_EDGE ;
case ILTT_VERT : return ITTT_VERT ;
case ILTT_EDGE : return ITTT_PNT ;
default : return ITTT_NO ;
}
return nTriaTriaIntersCases[nRes1][nRes2] ;
}
//----------------------------------------------------------------------------
+20
View File
@@ -59,6 +59,7 @@ class StmTria
int nEFlag ;
mutable int nPart ;
mutable int nTemp ;
mutable int nTempPart ;
} ;
//----------------------------------------------------------------------------
@@ -68,6 +69,19 @@ struct Stm3Int {
int nI1 ; int nI2 ; int nI3 ;
} ;
//----------------------------------------------------------------------------
// Struttura segmento di intersezione
struct IntSegment {
Point3d ptSt ;
Point3d ptEn ;
Vector3d vtOuter ;
bool bDegenerate ;
} ;
// Tipo chain
typedef std::vector<IntSegment> Chain ;
// Tipo vettore di Chain
typedef std::vector<Chain> CHAINVECTOR ;
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
class SurfTriMesh : public ISurfTriMesh, public IGeoObjRW
@@ -189,6 +203,9 @@ class SurfTriMesh : public ISurfTriMesh, public IGeoObjRW
bool GetFacetBBox( int nF, const Frame3d& frRef, BBox3d& b3Ref, int nFlag = BBF_STANDARD) const override ;
bool Cut( const Plane3d& plPlane, bool bSaveOnEq) override ;
bool GeneralizedCut( const ICurve& cvCurve, bool bSaveOnEq) override ;
bool Add( const ISurfTriMesh& Other) override ;
bool Intersect( const ISurfTriMesh& Other) override ;
bool Subtract( const ISurfTriMesh& Other) override ;
bool GetAllTriaOverlapBox( const BBox3d& b3Box, INTVECTOR& vT) const override ;
const BBox3d& GetAllTriaBox( void) const override ;
int GetPartCount( void) const override ;
@@ -255,6 +272,9 @@ class SurfTriMesh : public ISurfTriMesh, public IGeoObjRW
void ResetHashGrids3d( void) const ;
bool VerifyHashGrids3d( void) const ;
bool VerifyConnection( void) const ;
bool DecomposeLoop( CHAINVECTOR& cvOpenChain, INTVECTOR& vnDegVec, std::vector<PNTVECTOR>& cvBoundClosedLoopVec, std::vector<bool>& vbInOut) ;
bool IntersectTriMeshTriangle( SurfTriMesh& Other) ;
bool IdentifyParts( void) const ;
private :
ObjGraphicsMgr m_OGrMgr ; // gestore grafica dell'oggetto
+1519 -344
View File
File diff suppressed because it is too large Load Diff
+54 -53
View File
@@ -622,40 +622,41 @@ VolZmap::CheckMapConnection( void)
for ( int tInt = 0 ; tInt < int( m_Values[tMap][tDex].size()) ; ++ tInt) {
m_Values[tMap][tDex][tInt].nCompo = 0 ;
// Controlli sui tratti di dexel non incidenti su nodi del reticolo
if ( tMap == 0) {
// Z degli estremi del segmento
double dZMin = m_Values[tMap][tDex][tInt].dMin ;
double dZMax = m_Values[tMap][tDex][tInt].dMax ;
// Indici k dei voxels in cui cadono le Z
int nKmin = int( floor( ( dZMin - 2 * EPS_SMALL) / m_dStep - 0.5)) ;
int nKmax = int( floor( ( dZMax + 2 * EPS_SMALL) / m_dStep - 0.5)) ;
// Se cadono nello stesso voxel imposto a -1 il valore della componente connessa
if ( nKmax - nKmin == 0)
m_Values[tMap][tDex][tInt].nCompo = -1 ;
}
else if ( tMap == 1) {
// X degli estremi del segmento
double dXMin = m_Values[tMap][tDex][tInt].dMin ;
double dXMax = m_Values[tMap][tDex][tInt].dMax ;
// Indici i dei voxels in cui cadono le X
int nImin = int( floor( ( dXMin - 2 * EPS_SMALL) / m_dStep - 0.5)) ;
int nImax = int( floor( ( dXMax + 2 * EPS_SMALL) / m_dStep - 0.5)) ;
// Se cadono nello stesso voxel imposto a -1 il valore della componente connessa
if ( nImax - nImin == 0)
m_Values[tMap][tDex][tInt].nCompo = -1 ;
}
else {
// Y degli estremi del segmento
double dYMin = m_Values[tMap][tDex][tInt].dMin ;
double dYMax = m_Values[tMap][tDex][tInt].dMax ;
// Indici j dei voxels in cui cadono le X
int nJmin = int( floor( ( dYMin - 2 * EPS_SMALL) / m_dStep - 0.5)) ;
int nJmax = int( floor( ( dYMax + 2 * EPS_SMALL) / m_dStep - 0.5)) ;
// Se cadono nello stesso voxel imposto a -1 il valore della componente connessa
if ( nJmax - nJmin == 0)
m_Values[tMap][tDex][tInt].nCompo = -1 ;
}
//// Controlli sui tratti di dexel non incidenti su nodi del reticolo
// if ( tMap == 0) {
// // Z degli estremi del segmento
// double dZMin = m_Values[tMap][tDex][tInt].dMin ;
// double dZMax = m_Values[tMap][tDex][tInt].dMax ;
// // Indici k dei voxels in cui cadono le Z
// int nKmin = int( floor( ( dZMin - 2 * EPS_SMALL) / m_dStep - 0.5)) ;
// int nKmax = int( floor( ( dZMax + 2 * EPS_SMALL) / m_dStep - 0.5)) ;
// // Se cadono nello stesso voxel imposto a -1 il valore della componente connessa
// if ( nKmax - nKmin == 0)
// m_Values[tMap][tDex][tInt].nCompo = -1 ;
// }
// else if ( tMap == 1) {
// // X degli estremi del segmento
// double dXMin = m_Values[tMap][tDex][tInt].dMin ;
// double dXMax = m_Values[tMap][tDex][tInt].dMax ;
// // Indici i dei voxels in cui cadono le X
// int nImin = int( floor( ( dXMin - 2 * EPS_SMALL) / m_dStep - 0.5)) ;
// int nImax = int( floor( ( dXMax + 2 * EPS_SMALL) / m_dStep - 0.5)) ;
// // Se cadono nello stesso voxel imposto a -1 il valore della componente connessa
// if ( nImax - nImin == 0)
// m_Values[tMap][tDex][tInt].nCompo = -1 ;
// }
// else {
// // Y degli estremi del segmento
// double dYMin = m_Values[tMap][tDex][tInt].dMin ;
// double dYMax = m_Values[tMap][tDex][tInt].dMax ;
// // Indici j dei voxels in cui cadono le X
// int nJmin = int( floor( ( dYMin - 2 * EPS_SMALL) / m_dStep - 0.5)) ;
// int nJmax = int( floor( ( dYMax + 2 * EPS_SMALL) / m_dStep - 0.5)) ;
// // Se cadono nello stesso voxel imposto a -1 il valore della componente connessa
// if ( nJmax - nJmin == 0)
// m_Values[tMap][tDex][tInt].nCompo = -1 ;
// }
}
}
}
@@ -725,8 +726,8 @@ VolZmap::ExpandFromXInterval( IntContaier& IntCont)
// Quote estreme del segmento lungo X
double dMinX = m_Values[1][tDex][tInt].dMin ;
double dMaxX = m_Values[1][tDex][tInt].dMax ;
double dMinDX = max( floor( ( dMinX - EPS_SMALL) / m_dStep - 0.5), 0.) ;
double dMaxDX = max( floor( ( dMaxX + EPS_SMALL) / m_dStep - 0.5), 0.) ;
double dMinDX = max( floor( ( dMinX - 2 * EPS_SMALL) / m_dStep - 0.5), 0.) ;
double dMaxDX = max( floor( ( dMaxX + 2 * EPS_SMALL) / m_dStep - 0.5), 0.) ;
// Indici estremi dei dei dexel ortogonali
// che possono intersecare il segmento di partenza
int tStartI = min( int( dMinDX), ( m_nNx[0] - 1)) ;
@@ -746,8 +747,8 @@ VolZmap::ExpandFromXInterval( IntContaier& IntCont)
// Se i segmenti si incrociano e il nuovo trovato non
// ha già un indice assegnato, assegno l'indice e
// aggiungo l'intervallo trovato allo stack.
if ( dZmin - EPS_SMALL < dZ &&
dZmax + EPS_SMALL > dZ &&
if ( dZmin - 2 * EPS_SMALL < dZ &&
dZmax + 2 * EPS_SMALL > dZ &&
m_Values[0][tGrIndex1 * m_nNx[0] + tI][tIntZ].nCompo == 0) {
m_Values[0][tGrIndex1 * m_nNx[0] + tI][tIntZ].nCompo = m_Values[1][tDex][tInt].nCompo ;
IntervalIndexes NewInterval ;
@@ -766,8 +767,8 @@ VolZmap::ExpandFromXInterval( IntContaier& IntCont)
// Se i segmenti si incrociano e il nuovo trovato non
// ha già un indice assegnato, assegno l'indice e
// aggiungo l'intervallo trovato allo stack.
if ( dYmin - EPS_SMALL < dY &&
dYmax + EPS_SMALL > dY &&
if ( dYmin - 2 * EPS_SMALL < dY &&
dYmax + 2 * EPS_SMALL > dY &&
m_Values[2][tI * m_nNx[2] + tGrIndex2][tIntY].nCompo == 0) {
m_Values[2][tI * m_nNx[2] + tGrIndex2][tIntY].nCompo = m_Values[1][tDex][tInt].nCompo ;
IntervalIndexes NewInterval ;
@@ -796,8 +797,8 @@ VolZmap::ExpandFromYInterval( IntContaier& IntCont)
// Quote estreme del segmento lungo Y
double dMinY = m_Values[2][tDex][tInt].dMin ;
double dMaxY = m_Values[2][tDex][tInt].dMax ;
double dMinDY = max( floor( ( dMinY - EPS_SMALL) / m_dStep - 0.5), 0.) ;
double dMaxDY = max( floor( ( dMaxY + EPS_SMALL) / m_dStep - 0.5), 0.) ;
double dMinDY = max( floor( ( dMinY - 2 * EPS_SMALL) / m_dStep - 0.5), 0.) ;
double dMaxDY = max( floor( ( dMaxY + 2 * EPS_SMALL) / m_dStep - 0.5), 0.) ;
// Indici estremi dei dei dexel ortogonali
// che possono intersecare il segmento di partenza
int tStartJ = min( int( dMinDY), ( m_nNy[0] - 1)) ;
@@ -817,8 +818,8 @@ VolZmap::ExpandFromYInterval( IntContaier& IntCont)
// Se i segmenti si incrociano e il nuovo trovato non
// ha già un indice assegnato, assegno l'indice e
// aggiungo l'intervallo trovato allo stack.
if ( dZmin - EPS_SMALL < dZ &&
dZmax + EPS_SMALL > dZ &&
if ( dZmin - 2 * EPS_SMALL < dZ &&
dZmax + 2 * EPS_SMALL > dZ &&
m_Values[0][tJ * m_nNx[0] + tGrIndex2][tIntZ].nCompo == 0) {
m_Values[0][tJ * m_nNx[0] + tGrIndex2][tIntZ].nCompo = m_Values[2][tDex][tInt].nCompo ;
IntervalIndexes NewInterval ;
@@ -837,8 +838,8 @@ VolZmap::ExpandFromYInterval( IntContaier& IntCont)
// Se i segmenti si incrociano e il nuovo trovato non
// ha già un indice assegnato, assegno l'indice e
// aggiungo l'intervallo trovato allo stack.
if ( dXmin - EPS_SMALL < dX &&
dXmax + EPS_SMALL > dX &&
if ( dXmin - 2 * EPS_SMALL < dX &&
dXmax + 2 * EPS_SMALL > dX &&
m_Values[1][tGrIndex1 * m_nNx[1] + tJ][tIntX].nCompo == 0) {
m_Values[1][tGrIndex1 * m_nNx[1] + tJ][tIntX].nCompo = m_Values[2][tDex][tInt].nCompo ;
IntervalIndexes NewInterval ;
@@ -867,8 +868,8 @@ VolZmap::ExpandFromZInterval( IntContaier& IntCont)
// Quote estreme del segmento lungo Z
double dMinZ = m_Values[0][tDex][tInt].dMin ;
double dMaxZ = m_Values[0][tDex][tInt].dMax ;
double dMinDZ = max( floor( ( dMinZ - EPS_SMALL) / m_dStep - 0.5), 0.) ;
double dMaxDZ = max( floor( ( dMaxZ + EPS_SMALL) / m_dStep - 0.5), 0.) ;
double dMinDZ = max( floor( ( dMinZ - 2 * EPS_SMALL) / m_dStep - 0.5), 0.) ;
double dMaxDZ = max( floor( ( dMaxZ + 2 * EPS_SMALL) / m_dStep - 0.5), 0.) ;
// Indici estremi dei dexel ortogonali
// che possono intersecare il segmento di partenza
int tStartK = min( int( dMinDZ), ( m_nNy[1] - 1)) ;
@@ -888,9 +889,9 @@ VolZmap::ExpandFromZInterval( IntContaier& IntCont)
// Se i segmenti si incrociano e il nuovo trovato non
// ha già un indice assegnato, assegno l'indice e
// aggiungo l'intervallo trovato allo stack.
if ( dXmin - EPS_SMALL < dX &&
dXmax + EPS_SMALL > dX &&
m_Values[1][tK * m_nNx[1] + tGrIndex2][tIntX].nCompo == 0) {
if ( dXmin - 2 * EPS_SMALL < dX &&
dXmax + 2 * EPS_SMALL > dX &&
m_Values[1][tK * m_nNx[1] + tGrIndex2][tIntX].nCompo == 0) {
m_Values[1][tK * m_nNx[1] + tGrIndex2][tIntX].nCompo = m_Values[0][tDex][tInt].nCompo ;
IntervalIndexes NewInterval ;
NewInterval.tMap = 1 ;
@@ -908,8 +909,8 @@ VolZmap::ExpandFromZInterval( IntContaier& IntCont)
// Se i segmenti si incrociano e il nuovo trovato non
// ha già un indice assegnato, assegno l'indice e
// aggiungo l'intervallo trovato allo stack.
if ( dYmin - EPS_SMALL < dY &&
dYmax + EPS_SMALL > dY &&
if ( dYmin - 2 * EPS_SMALL < dY &&
dYmax + 2 * EPS_SMALL > dY &&
m_Values[2][tGrIndex1 * m_nNx[2] + tK][tIntY].nCompo == 0) {
m_Values[2][tGrIndex1 * m_nNx[2] + tK][tIntY].nCompo = m_Values[0][tDex][tInt].nCompo ;
IntervalIndexes NewInterval ;
+2 -2
View File
@@ -120,8 +120,8 @@ VolZmap::SubtractIntervals( int nGrid, int nI, int nJ,
// Elimino residui di intervalli inutili
for ( int i = 0 ; i < int( vDexel.size()) ; ++ i) {
int nMinN = int( floor( ( vDexel[i].dMax + 2 * EPS_SMALL - 0.5 * m_dStep) / m_dStep)) ;
int nMaxN = int( floor( ( vDexel[i].dMin - 2 * EPS_SMALL - 0.5 * m_dStep) / m_dStep)) ;
int nMaxN = int( floor( ( vDexel[i].dMax + 2 * EPS_SMALL - 0.5 * m_dStep) / m_dStep)) ;
int nMinN = int( floor( ( vDexel[i].dMin - 2 * EPS_SMALL - 0.5 * m_dStep) / m_dStep)) ;
if ( nMinN == nMaxN) {
vDexel.erase( vDexel.begin() + i) ;
-- i ;