diff --git a/VolZmap.h b/VolZmap.h index d542e4c..9fa76f3 100644 --- a/VolZmap.h +++ b/VolZmap.h @@ -133,8 +133,12 @@ class VolZmap : public IVolZmap, public IGeoObjRW enum CubeType { VOX_EXTERN = 1, VOX_ON_BOUNDARY = 0, VOX_INNER = -1} ; - typedef std::unordered_map VoxelContainer ; - + // Per la creazione dei rettangoli grandi + struct HeigthAndColor { + int nTool ; + double dHeigth ; + } ; + typedef std::unordered_map VoxelContainer ; // Struttura voxel struct Voxel { int nI, nJ, nK ; @@ -298,7 +302,7 @@ class VolZmap : public IVolZmap, public IGeoObjRW bool ProcessVoxContXY( VoxelContainer& VoxContXY, bool bPlus, TRIA3DLIST& lstTria) const ; bool ProcessVoxContYZ( VoxelContainer& VoxContYZ, bool bPlus, TRIA3DLIST& lstTria) const ; bool ProcessVoxContXZ( VoxelContainer& VoxContXZ, bool bPlus, TRIA3DLIST& lstTria) const ; - bool Find( const VoxelContainer& VoxCont, int nI, int nJ, int nK, double dPos) const ; + bool Find( const VoxelContainer& VoxCont, int nI, int nJ, int nK, double dPos, int nTool) const ; bool Remove( VoxelContainer& VoxCont, int nI, int nJ, int nK) const ; // Connessione Zmap struct IntervalIndexes { diff --git a/VolZmapGraphics.cpp b/VolZmapGraphics.cpp index f114184..79723d2 100644 --- a/VolZmapGraphics.cpp +++ b/VolZmapGraphics.cpp @@ -89,7 +89,7 @@ TestOnNormal( const VectorField CompoVert[], int nCompoElem) //---------------------------------------------------------------------------- bool -CanonicPlaneTest( const VectorField CompoVert[], int nDir, double& dPos) +CanonicPlaneTest( const VectorField CompoVert[], int nDir, double& dPos, int& nTool) { // Verifico posizione dei punti int nI ; @@ -116,10 +116,19 @@ CanonicPlaneTest( const VectorField CompoVert[], int nDir, double& dPos) case Z_PLUS : vtN = Z_AX ; break ; case Z_MINUS : vtN = - Z_AX ; break ; } + int nDifferent = 0 ; for ( int i = 0 ; i < 4 ; ++ i) { if ( CompoVert[i].vtNorm * vtN < 0.999) return false ; + for ( int j = i + 1 ; j < 4 ; ++ j) { + if ( CompoVert[i].nToolFlag != CompoVert[j].nToolFlag) + ++ nDifferent ; + else + nTool = CompoVert[i].nToolFlag ; + } } + if ( nDifferent > 3) + return false ; // Superati tutti i test return true ; } @@ -1753,61 +1762,85 @@ VolZmap::ExtMarchingCubes( int nBlock, TRIA3DLIST& lstTria, TriHolder& triHold) // Controllo se il voxel ha una sola faccia che giace in un piano canonico e quindi ha gestione speciale // Faccia XY normale Z+ if ( nIndex == 15) { + int nTool ; double dPos ; - if ( CanonicPlaneTest( CompoVert[0], Z_PLUS, dPos)) { + if ( CanonicPlaneTest( CompoVert[0], Z_PLUS, dPos, nTool)) { int nN ; GetVoxNFromIJK( i, j, k, nN) ; - VoxContXYSup.emplace( nN, dPos) ; + HeigthAndColor FlatVox ; + FlatVox.nTool = nTool ; + FlatVox.dHeigth = dPos ; + VoxContXYSup.emplace( nN, FlatVox) ; continue ; } } // Faccia YZ normale X+ else if ( nIndex == 153) { + int nTool ; double dPos ; - if ( CanonicPlaneTest( CompoVert[0], X_PLUS, dPos)) { + if ( CanonicPlaneTest( CompoVert[0], X_PLUS, dPos, nTool)) { int nN ; GetVoxNFromIJK( i, j, k, nN) ; - VoxContYZSup.emplace( nN, dPos) ; + HeigthAndColor FlatVox ; + FlatVox.nTool = nTool ; + FlatVox.dHeigth = dPos ; + VoxContYZSup.emplace( nN, FlatVox) ; continue ; } } // Faccia ZX normale Y+ else if ( nIndex == 51) { + int nTool ; double dPos ; - if ( CanonicPlaneTest( CompoVert[0], Y_PLUS, dPos)) { + if ( CanonicPlaneTest( CompoVert[0], Y_PLUS, dPos, nTool)) { int nN ; GetVoxNFromIJK( i, j, k, nN) ; - VoxContXZSup.emplace( nN, dPos) ; + HeigthAndColor FlatVox ; + FlatVox.nTool = nTool ; + FlatVox.dHeigth = dPos ; + VoxContXZSup.emplace( nN, FlatVox) ; continue ; } } // Faccia YX normale Z- else if ( nIndex == 240) { + int nTool ; double dPos ; - if ( CanonicPlaneTest( CompoVert[0], Z_MINUS, dPos)) { + if ( CanonicPlaneTest( CompoVert[0], Z_MINUS, dPos, nTool)) { int nN ; GetVoxNFromIJK( i, j, k, nN) ; - VoxContXYInf.emplace( nN, dPos) ; + HeigthAndColor FlatVox ; + FlatVox.nTool = nTool ; + FlatVox.dHeigth = dPos ; + VoxContXYInf.emplace( nN, FlatVox) ; continue ; } } // Faccia ZY normale X- else if ( nIndex == 102) { + int nTool ; double dPos ; - if ( CanonicPlaneTest( CompoVert[0], X_MINUS, dPos)) { + if ( CanonicPlaneTest( CompoVert[0], X_MINUS, dPos, nTool)) { int nN ; GetVoxNFromIJK( i, j, k, nN) ; - VoxContYZInf.emplace( nN, dPos) ; + HeigthAndColor FlatVox ; + FlatVox.nTool = nTool ; + FlatVox.dHeigth = dPos ; + VoxContYZInf.emplace( nN, FlatVox) ; continue ; } } // Faccia XZ normale Y- else if ( nIndex == 204) { + int nTool ; double dPos ; - if ( CanonicPlaneTest( CompoVert[0], Y_MINUS, dPos)) { + if ( CanonicPlaneTest( CompoVert[0], Y_MINUS, dPos, nTool)) { int nN ; GetVoxNFromIJK( i, j, k, nN) ; - VoxContXZInf.emplace( nN, dPos) ; + HeigthAndColor FlatVox ; + FlatVox.nTool = nTool ; + FlatVox.dHeigth = dPos ; + VoxContXZInf.emplace( nN, FlatVox) ; continue ; } } @@ -2073,6 +2106,12 @@ VolZmap::ExtMarchingCubes( int nBlock, TRIA3DLIST& lstTria, TriHolder& triHold) // Il triangolo è pronto Triangle3d CurrentTriangle ; CurrentTriangle.Set( ptSol, CompoVert[nCompCount - 1][nj].ptInt, CompoVert[nCompCount - 1][ni].ptInt) ; + if ( CompoVert[nCompCount - 1][nj].nToolFlag == CompoVert[nCompCount - 1][ni].nToolFlag) + CurrentTriangle.SetFlag( CompoVert[nCompCount - 1][nj].nToolFlag) ; + else if ( CompoVert[nCompCount - 1][nj].nToolFlag == 0) + CurrentTriangle.SetFlag( CompoVert[nCompCount - 1][ni].nToolFlag) ; + else if ( CompoVert[nCompCount - 1][ni].nToolFlag == 0) + CurrentTriangle.SetFlag( CompoVert[nCompCount - 1][nj].nToolFlag) ; CurrentTriangle.Validate( true) ; // Aggiungo triangolo al vettore temporaneo triContainer.emplace_back( CurrentTriangle) ; @@ -2129,13 +2168,10 @@ VolZmap::ExtMarchingCubes( int nBlock, TRIA3DLIST& lstTria, TriHolder& triHold) // Se tale normale esiste if ( bInversione2) { - - // Soluzione del sistema nel sistema Zmap - Point3d ptSolZMapFrame = ptSol ; - + // Se la soluzione non cade nel voxel di appartenenza vedo se può // essere riportata dentro muovendosi lungo la linea di feature. - if ( ! IsPointInsideVoxelApprox( i, j, k, ptSolZMapFrame)) { + if ( ! IsPointInsideVoxelApprox( i, j, k, ptSol)) { Vector3d vtNullSpace( dMatrixV( 0, 2), dMatrixV( 1, 2), dMatrixV( 2, 2)) ; double dParInt1, dParInt2 ; @@ -2145,16 +2181,14 @@ VolZmap::ExtMarchingCubes( int nBlock, TRIA3DLIST& lstTria, TriHolder& triHold) ( ( j + 1) * N_DEXVOXRATIO + 0.5) * m_dStep, ( ( k + 1) * N_DEXVOXRATIO + 0.5) * m_dStep) ; // Caso in cui può essere riportata dentro: se il voxel in cui cade la feature è pieno // la riporto muovendola lungo la sua linea - if ( IntersLineBox( ptSolZMapFrame, vtNullSpace, ptVoxMin, ptVoxMax, dParInt1, dParInt2)) { + if ( IntersLineBox( ptSol, vtNullSpace, ptVoxMin, ptVoxMax, dParInt1, dParInt2)) { triContainer.resize( 0) ; double dPar = abs( dParInt1) < abs( dParInt2) ? dParInt1 + ( dParInt2 - dParInt1) / 100 : dParInt2 + ( dParInt1 - dParInt2) / 100 ; - - Point3d ptNewSol = ptSolZMapFrame + dPar * vtNullSpace ; - - ptSol = ptNewSol ; + + ptSol += dPar * vtNullSpace ; // Costruisco triangoli di prova for ( int ni = 0 ; ni < nVertComp[nCompCount - 1] ; ++ ni) { @@ -2162,6 +2196,12 @@ VolZmap::ExtMarchingCubes( int nBlock, TRIA3DLIST& lstTria, TriHolder& triHold) // Il triangolo è pronto Triangle3d CurrentTriangle ; CurrentTriangle.Set( ptSol, CompoVert[nCompCount - 1][nj].ptInt, CompoVert[nCompCount - 1][ni].ptInt) ; + if ( CompoVert[nCompCount - 1][nj].nToolFlag == CompoVert[nCompCount - 1][ni].nToolFlag) + CurrentTriangle.SetFlag( CompoVert[nCompCount - 1][nj].nToolFlag) ; + else if ( CompoVert[nCompCount - 1][nj].nToolFlag == 0) + CurrentTriangle.SetFlag( CompoVert[nCompCount - 1][ni].nToolFlag) ; + else if ( CompoVert[nCompCount - 1][ni].nToolFlag == 0) + CurrentTriangle.SetFlag( CompoVert[nCompCount - 1][nj].nToolFlag) ; CurrentTriangle.Validate( true) ; // Aggiungo triangolo al vettore temporaneo triContainer.emplace_back( CurrentTriangle) ; @@ -2174,7 +2214,7 @@ VolZmap::ExtMarchingCubes( int nBlock, TRIA3DLIST& lstTria, TriHolder& triHold) else { int nAdjVoxI, nAdjVoxJ, nAdjVoxK ; - if ( GetPointVoxel( ptSolZMapFrame, nAdjVoxI, nAdjVoxJ, nAdjVoxK)) { + if ( GetPointVoxel( ptSol, nAdjVoxI, nAdjVoxJ, nAdjVoxK)) { // Classificazione del voxel adiacente int nAdjIndex = CalcIndex( nAdjVoxI, nAdjVoxJ, nAdjVoxK) ; @@ -2227,17 +2267,20 @@ VolZmap::ExtMarchingCubes( int nBlock, TRIA3DLIST& lstTria, TriHolder& triHold) double dPar = abs( dParInt1) < abs( dParInt2) ? dParInt1 + ( dParInt2 - dParInt1) / 100 : dParInt2 + ( dParInt1 - dParInt2) / 100 ; - - Point3d ptNewSol = ptSol + dPar * vtNullSpace ; - - ptSol = ptNewSol ; - + + ptSol += dPar * vtNullSpace ; // Costruisco triangoli di prova for ( int ni = 0 ; ni < nVertComp[nCompCount - 1] ; ++ ni) { int nj = ( ni + 1 < nVertComp[nCompCount - 1]) ? ni + 1 : 0 ; // Il triangolo è pronto Triangle3d CurrentTriangle ; CurrentTriangle.Set( ptSol, CompoVert[nCompCount - 1][nj].ptInt, CompoVert[nCompCount - 1][ni].ptInt) ; + if ( CompoVert[nCompCount - 1][nj].nToolFlag == CompoVert[nCompCount - 1][ni].nToolFlag) + CurrentTriangle.SetFlag( CompoVert[nCompCount - 1][nj].nToolFlag) ; + else if ( CompoVert[nCompCount - 1][nj].nToolFlag == 0) + CurrentTriangle.SetFlag( CompoVert[nCompCount - 1][ni].nToolFlag) ; + else if ( CompoVert[nCompCount - 1][ni].nToolFlag == 0) + CurrentTriangle.SetFlag( CompoVert[nCompCount - 1][nj].nToolFlag) ; CurrentTriangle.Validate( true) ; // Aggiungo triangolo al vettore temporaneo triContainer.emplace_back( CurrentTriangle) ; @@ -2394,8 +2437,10 @@ VolZmap::ExtMarchingCubes( int nBlock, TRIA3DLIST& lstTria, TriHolder& triHold) int nTool0 = CompoTriVert[nCompCount - 1][TriIndex].nToolFlag ; int nTool1 = CompoTriVert[nCompCount - 1][TriIndex+1].nToolFlag ; int nTool2 = CompoTriVert[nCompCount - 1][TriIndex+2].nToolFlag ; - if ( nTool0 == nTool1 && nTool0 == nTool2) - CurrentTriangle.SetFlag( nTool0) ; + if ( nTool0 == nTool1 || nTool0 == nTool2) + CurrentTriangle.SetFlag( nTool0) ; + else if ( nTool1 == nTool2) + CurrentTriangle.SetFlag( nTool1) ; // bool bV = CurrentTriangle.Validate( true) ; // Riporto le coordinate nel sistema in cui è immerso lo Zmap @@ -2419,8 +2464,10 @@ VolZmap::ExtMarchingCubes( int nBlock, TRIA3DLIST& lstTria, TriHolder& triHold) int nTool0 = CompoTriVert[nCompCount - 1][TriIndex].nToolFlag ; int nTool1 = CompoTriVert[nCompCount - 1][TriIndex+1].nToolFlag ; int nTool2 = CompoTriVert[nCompCount - 1][TriIndex+2].nToolFlag ; - if ( nTool0 == nTool1 && nTool0 == nTool2) + if ( nTool0 == nTool1 || nTool0 == nTool2) CurrentTriangle.SetFlag( nTool0) ; + else if ( nTool1 == nTool2) + CurrentTriangle.SetFlag( nTool1) ; // bool bV = CurrentTriangle.Validate( true) ; // Riporto le coordinate nel sistema in cui è immerso lo Zmap @@ -3434,8 +3481,9 @@ VolZmap::ProcessVoxContXY( VoxelContainer& VoxContXY, bool bPlus, TRIA3DLIST& ls int nMinJ = nJ ; int nMaxI = nI ; int nMaxJ = nJ ; - double dCordZ = ( *it).second ; - + int nToolNum = ( *it).second.nTool ; + double dCordZ = ( *it).second.dHeigth ; + // Flag sul ritrovamento di un rettangolo più grande. bool bOkI = true ; bool bOkJ = true ; @@ -3445,7 +3493,7 @@ VolZmap::ProcessVoxContXY( VoxelContainer& VoxContXY, bool bPlus, TRIA3DLIST& ls // Analizzo linea superiore bool bSupJ = true ; for ( int i = nMinI ; bSupJ && i <= nMaxI ; ++ i) { - if ( ! Find( VoxContXY, i, nMaxJ + 1, nK, dCordZ)) + if ( ! Find( VoxContXY, i, nMaxJ + 1, nK, dCordZ, nToolNum)) bSupJ = false ; } // Se linea superiore accettata, elimino i voxel @@ -3457,7 +3505,7 @@ VolZmap::ProcessVoxContXY( VoxelContainer& VoxContXY, bool bPlus, TRIA3DLIST& ls // Analizzo linea inferiore bool bInfJ = true ; for ( int i = nMinI ; bInfJ && i <= nMaxI ; ++ i) { - if ( ! Find( VoxContXY, i, nMinJ - 1, nK, dCordZ)) + if ( ! Find( VoxContXY, i, nMinJ - 1, nK, dCordZ, nToolNum)) bInfJ = false ; } // Se linea inferiore accettata, elimino i voxel @@ -3473,7 +3521,7 @@ VolZmap::ProcessVoxContXY( VoxelContainer& VoxContXY, bool bPlus, TRIA3DLIST& ls // Analizzo linea destra bool bSupI = true ; for ( int j = nMinJ ; bSupI && j <= nMaxJ ; ++ j) { - if ( ! Find( VoxContXY, nMaxI + 1, j, nK, dCordZ)) + if ( ! Find( VoxContXY, nMaxI + 1, j, nK, dCordZ, nToolNum)) bSupI = false ; } // Se linea destra accettata, elimino i voxel @@ -3485,7 +3533,7 @@ VolZmap::ProcessVoxContXY( VoxelContainer& VoxContXY, bool bPlus, TRIA3DLIST& ls // Analizzo linea sinistra bool bInfI = true ; for ( int j = nMinJ ; bInfI && j <= nMaxJ ; ++ j) { - if ( ! Find( VoxContXY, nMinI - 1, j, nK, dCordZ)) + if ( ! Find( VoxContXY, nMinI - 1, j, nK, dCordZ, nToolNum)) bInfI = false ; } // Se linea sinistra accettata, elimino i voxel @@ -3521,6 +3569,8 @@ VolZmap::ProcessVoxContXY( VoxelContainer& VoxContXY, bool bPlus, TRIA3DLIST& ls Tria0.Set( ptT0, ptT3, ptT1) ; Tria1.Set( ptT1, ptT3, ptT2) ; } + Tria0.SetFlag( nToolNum) ; + Tria1.SetFlag( nToolNum) ; bool bV0 = Tria0.Validate( true) ; bool bV1 = Tria1.Validate( true) ; // Aggiungo alla lista @@ -3553,7 +3603,8 @@ VolZmap::ProcessVoxContYZ( VoxelContainer& VoxContYZ, bool bPlus, TRIA3DLIST& ls int nMinK = nK ; int nMaxJ = nJ ; int nMaxK = nK ; - double dCordX = ( *it).second ; + int nToolNum = ( *it).second.nTool ; + double dCordX = ( *it).second.dHeigth ; // Flag sul ritrovamento di un rettangolo più grande. bool bOkJ = true ; @@ -3564,7 +3615,7 @@ VolZmap::ProcessVoxContYZ( VoxelContainer& VoxContYZ, bool bPlus, TRIA3DLIST& ls // Analizzo linea superiore bool bSupK = true ; for ( int j = nMinJ ; bSupK && j <= nMaxJ ; ++ j) { - if ( ! Find( VoxContYZ, nI, j, nMaxK + 1, dCordX)) + if ( ! Find( VoxContYZ, nI, j, nMaxK + 1, dCordX, nToolNum)) bSupK = false ; } // Se linea superiore accettata, elimino i voxel @@ -3576,7 +3627,7 @@ VolZmap::ProcessVoxContYZ( VoxelContainer& VoxContYZ, bool bPlus, TRIA3DLIST& ls // Analizzo linea inferiore bool bInfK = true ; for ( int j = nMinJ ; bInfK && j <= nMaxJ ; ++ j) { - if ( ! Find( VoxContYZ, nI, j, nMinK - 1, dCordX)) + if ( ! Find( VoxContYZ, nI, j, nMinK - 1, dCordX, nToolNum)) bInfK = false ; } // Se linea inferiore accettata, elimino i voxel @@ -3592,7 +3643,7 @@ VolZmap::ProcessVoxContYZ( VoxelContainer& VoxContYZ, bool bPlus, TRIA3DLIST& ls // Analizzo linea destra bool bSupJ = true ; for ( int k = nMinK ; bSupJ && k <= nMaxK ; ++ k) { - if ( ! Find( VoxContYZ, nI, nMaxJ + 1, k, dCordX)) + if ( ! Find( VoxContYZ, nI, nMaxJ + 1, k, dCordX, nToolNum)) bSupJ = false ; } // Se linea destra accettata, elimino i voxel @@ -3604,7 +3655,7 @@ VolZmap::ProcessVoxContYZ( VoxelContainer& VoxContYZ, bool bPlus, TRIA3DLIST& ls // Analizzo linea sinistra bool bInfJ = true ; for ( int k = nMinK ; bInfJ && k <= nMaxK ; ++ k) { - if ( ! Find( VoxContYZ, nI, nMinJ - 1, k, dCordX)) + if ( ! Find( VoxContYZ, nI, nMinJ - 1, k, dCordX, nToolNum)) bInfJ = false ; } // Se linea sinistra accettata, elimino i voxel @@ -3640,6 +3691,8 @@ VolZmap::ProcessVoxContYZ( VoxelContainer& VoxContYZ, bool bPlus, TRIA3DLIST& ls Tria0.Set( ptT0, ptT3, ptT1) ; Tria1.Set( ptT1, ptT3, ptT2) ; } + Tria0.SetFlag( nToolNum) ; + Tria1.SetFlag( nToolNum) ; bool bV0 = Tria0.Validate( true) ; bool bV1 = Tria1.Validate( true) ; // Aggiungo alla lista @@ -3672,7 +3725,8 @@ VolZmap::ProcessVoxContXZ( VoxelContainer& VoxContXZ, bool bPlus, TRIA3DLIST& ls int nMinK = nK ; int nMaxI = nI ; int nMaxK = nK ; - double dCordY = ( *it).second ; + int nToolNum = ( *it).second.nTool ; + double dCordY = ( *it).second.dHeigth ; // Flag sul ritrovamento di un rettangolo più grande. bool bOkI = true ; @@ -3683,7 +3737,7 @@ VolZmap::ProcessVoxContXZ( VoxelContainer& VoxContXZ, bool bPlus, TRIA3DLIST& ls // Analizzo linea superiore bool bSupK = true ; for ( int i = nMinI ; bSupK && i <= nMaxI ; ++ i) { - if ( ! Find( VoxContXZ, i, nJ, nMaxK + 1, dCordY)) + if ( ! Find( VoxContXZ, i, nJ, nMaxK + 1, dCordY, nToolNum)) bSupK = false ; } // Se linea superiore accettata, elimino i voxel @@ -3695,7 +3749,7 @@ VolZmap::ProcessVoxContXZ( VoxelContainer& VoxContXZ, bool bPlus, TRIA3DLIST& ls // Analizzo linea inferiore bool bInfK = true ; for ( int i = nMinI ; bInfK && i <= nMaxI ; ++ i) { - if ( ! Find( VoxContXZ, i, nJ, nMinK - 1, dCordY)) + if ( ! Find( VoxContXZ, i, nJ, nMinK - 1, dCordY, nToolNum)) bInfK = false ; } // Se linea inferiore accettata, elimino i voxel @@ -3711,7 +3765,7 @@ VolZmap::ProcessVoxContXZ( VoxelContainer& VoxContXZ, bool bPlus, TRIA3DLIST& ls // Analizzo linea destra bool bSupI = true ; for ( int k = nMinK ; bSupI && k <= nMaxK ; ++ k) { - if ( ! Find( VoxContXZ, nMaxI + 1, nJ, k, dCordY)) + if ( ! Find( VoxContXZ, nMaxI + 1, nJ, k, dCordY, nToolNum)) bSupI = false ; } // Se linea destra accettata, elimino i voxel @@ -3723,7 +3777,7 @@ VolZmap::ProcessVoxContXZ( VoxelContainer& VoxContXZ, bool bPlus, TRIA3DLIST& ls // Analizzo linea sinistra bool bInfI = true ; for ( int k = nMinK ; bInfI && k <= nMaxK ; ++ k) { - if ( ! Find( VoxContXZ, nMinI - 1, nJ, k, dCordY)) + if ( ! Find( VoxContXZ, nMinI - 1, nJ, k, dCordY, nToolNum)) bInfI = false ; } // Se linea sinistra accettata, elimino i voxel @@ -3759,6 +3813,8 @@ VolZmap::ProcessVoxContXZ( VoxelContainer& VoxContXZ, bool bPlus, TRIA3DLIST& ls Tria0.Set( ptT0, ptT1, ptT3) ; Tria1.Set( ptT1, ptT2, ptT3) ; } + Tria0.SetFlag( nToolNum) ; + Tria1.SetFlag( nToolNum) ; bool bV0 = Tria0.Validate( true) ; bool bV1 = Tria1.Validate( true) ; // Aggiungo alla lista @@ -3777,7 +3833,7 @@ VolZmap::ProcessVoxContXZ( VoxelContainer& VoxContXZ, bool bPlus, TRIA3DLIST& ls //---------------------------------------------------------------------------- bool -VolZmap::Find( const VoxelContainer& VoxCont, int nI, int nJ, int nK, double dPos) const +VolZmap::Find( const VoxelContainer& VoxCont, int nI, int nJ, int nK, double dPos, int nTool) const { // indice globale del voxel int nN ; @@ -3785,7 +3841,9 @@ VolZmap::Find( const VoxelContainer& VoxCont, int nI, int nJ, int nK, double dPo return false ; // cerco il voxel nel contenitore auto iter = VoxCont.find( nN) ; - return ( iter != VoxCont.end() && abs( dPos - ( *iter).second) < EPS_SMALL) ; + return ( iter != VoxCont.end() && + abs( dPos - ( *iter).second.dHeigth) < EPS_SMALL && + nTool == ( *iter).second.nTool) ; } //----------------------------------------------------------------------------