diff --git a/EgtGeomKernel.rc b/EgtGeomKernel.rc index d7d74f8..59e260b 100644 Binary files a/EgtGeomKernel.rc and b/EgtGeomKernel.rc differ diff --git a/VolZmap.cpp b/VolZmap.cpp index a0bc20b..d421e16 100644 --- a/VolZmap.cpp +++ b/VolZmap.cpp @@ -18,6 +18,7 @@ #include "NgeWriter.h" #include "NgeReader.h" #include "GeoConst.h" +#include "/EgtDev/Include/EgtNumUtils.h" #include "/EgtDev/Include/EGkUiUnits.h" #include "/EgtDev/Include/EGkIntervals.h" #include "/EgtDev/Include/EGkStringUtils3d.h" @@ -1121,6 +1122,7 @@ VolZmap::RemovePart( int nPart) for ( int nInt = 0 ; nInt < int( m_Values[nMap][nDex].size()) ; ++ nInt) { // Se l'intervallo appartiene alla componente da eliminare, lo cancello. if ( m_Values[nMap][nDex][nInt].nCompo == nPart + 1) { + SetToModifyDexelBlocks( nMap, nDex, nInt) ; m_Values[nMap][nDex].erase( m_Values[nMap][nDex].begin() + nInt) ; -- nInt ; } @@ -1139,6 +1141,162 @@ VolZmap::RemovePart( int nPart) return true ; } +//---------------------------------------------------------------------------- +bool +VolZmap::SetToModifyDexelBlocks( int nGrid, int nDex, int nInt) +{ + // Controllo sulla validità della griglia + if ( nGrid < 0 || nGrid > 2) + return false ; + // Controllo sulla validità del dexel + if ( nDex <= - 1 || nDex >= int( m_Values[nGrid].size())) + return false ; + // Controllo sulla validità dell'intervallo + if ( nInt <= - 1 || nInt >= int( m_Values[nGrid][nDex].size())) + return false ; + + + // Determino quali blocchi sono stati modificati + int nLayerBlock = m_nFracLin[0] * m_nFracLin[1] ; + // Indici del dexel + int nI = nDex % m_nNx[nGrid] ; + int nJ = nDex / m_nNx[nGrid] ; + // Quote estreme del dexel + double dMin = m_Values[nGrid][nDex][nInt].dMin ; + double dMax = m_Values[nGrid][nDex][nInt].dMax ; + + if ( nGrid == 0) { + + int nXStop = 1 ; + int nYStop = 1 ; + + int nXBlock[2] ; + int nYBlock[2] ; + + // Passo dal dexel al voxel + nI /= N_DEXVOXRATIO ; + nJ /= N_DEXVOXRATIO ; + + nXBlock[0] = min( nI / m_nVoxNumPerBlock, m_nFracLin[0] - 1) ; + nYBlock[0] = min( nJ / m_nVoxNumPerBlock, m_nFracLin[1] - 1) ; + + if ( nI % N_VOXBLOCK == 0 && nXBlock[0] > 0) { + nXBlock[1] = nXBlock[0] - 1 ; + ++ nXStop ; + } + + if ( nJ % N_VOXBLOCK == 0 && nYBlock[0] > 0) { + nYBlock[1] = nYBlock[0] - 1 ; + ++ nYStop ; + } + + // Numero di voxel lungo Z + int nVoxNumZ = int( m_nNy[1] / N_DEXVOXRATIO + ( m_nNy[1] % N_DEXVOXRATIO == 0 ? 1 : 2)) ; + + int nMinK = Clamp( int( floor( ( ( dMin - 0.5 * m_dStep) / ( N_DEXVOXRATIO * m_dStep) - EPS_SMALL))), 0, nVoxNumZ - 2) ; + int nMaxK = Clamp( int( floor( ( ( dMax + 0.5 * m_dStep) / ( N_DEXVOXRATIO * m_dStep) + EPS_SMALL))), 0, nVoxNumZ - 2) ; + + int nMinZBlock = ( m_nMapNum == 1 ? 0 : Clamp( nMinK / int( m_nVoxNumPerBlock), 0, int( m_nFracLin[2] - 1))) ; + int nMaxZBlock = min( int( m_nFracLin[2] - 1), nMaxK / int( m_nVoxNumPerBlock)) ; + + for ( int tI = 0 ; tI < nXStop ; ++ tI) { + for ( int tJ = 0 ; tJ < nYStop ; ++ tJ) { + for ( int k = nMinZBlock ; k <= nMaxZBlock ; ++ k) { + int nBlockNum = k * nLayerBlock + nYBlock[tJ] * m_nFracLin[0] + nXBlock[tI] ; + m_BlockToUpdate[nBlockNum] = true ; + } + } + } + } + else if ( nGrid == 1) { + + int nYStop = 1 ; + int nZStop = 1 ; + + int nYBlock[2] ; + int nZBlock[2] ; + + // Passo dal dexel al voxel + nI /= N_DEXVOXRATIO ; + nJ /= N_DEXVOXRATIO ; + + nYBlock[0] = min( nI / m_nVoxNumPerBlock, m_nFracLin[1] - 1) ; + nZBlock[0] = min( nJ / m_nVoxNumPerBlock, m_nFracLin[2] - 1) ; + + if ( nI % N_VOXBLOCK == 0 && nYBlock[0] > 0) { + nYBlock[1] = nYBlock[0] - 1 ; + ++ nYStop ; + } + + if ( nJ % N_VOXBLOCK == 0 && nZBlock[0] > 0) { + nZBlock[1] = nZBlock[0] - 1 ; + ++ nZStop ; + } + + // Numero di voxel lungo X + int nVoxNumX = int( m_nNx[0] / N_DEXVOXRATIO + ( m_nNx[0] % N_DEXVOXRATIO == 0 ? 1 : 2)) ; + + int nMinI = Clamp( int( floor( ( ( dMin - 0.5 * m_dStep) / ( N_DEXVOXRATIO * m_dStep) - EPS_SMALL))), 0, nVoxNumX - 2) ; + int nMaxI = Clamp( int( floor( ( ( dMax + 0.5 * m_dStep) / ( N_DEXVOXRATIO * m_dStep) + EPS_SMALL))), 0, nVoxNumX - 2) ; + + int nMinXBlock = Clamp( nMinI / int( m_nVoxNumPerBlock), 0, int( m_nFracLin[0] - 1)) ; + int nMaxXBlock = min( int( m_nFracLin[0] - 1), nMaxI / int( m_nVoxNumPerBlock)) ; + + for ( int tI = 0 ; tI < nYStop ; ++ tI) { + for ( int tJ = 0 ; tJ < nZStop ; ++ tJ) { + for ( int k = nMinXBlock ; k <= nMaxXBlock ; ++ k) { + int nBlockNum = nZBlock[tJ] * nLayerBlock + nYBlock[tI] * m_nFracLin[0] + k ; + m_BlockToUpdate[nBlockNum] = true ; + } + } + } + } + else if ( nGrid == 2) { + + int nXStop = 1 ; + int nZStop = 1 ; + + int nXBlock[2] ; + int nZBlock[2] ; + + // Passo dal dexel al voxel + nI /= N_DEXVOXRATIO ; + nJ /= N_DEXVOXRATIO ; + + nXBlock[0] = min( nJ / m_nVoxNumPerBlock, m_nFracLin[0] - 1) ; + nZBlock[0] = min( nI / m_nVoxNumPerBlock, m_nFracLin[2] - 1) ; + + if ( nJ % N_VOXBLOCK == 0 && nXBlock[0] > 0) { + nXBlock[1] = nXBlock[0] - 1 ; + ++ nXStop ; + } + + if ( nI % N_VOXBLOCK == 0 && nZBlock[0] > 0) { + nZBlock[1] = nZBlock[0] - 1 ; + ++ nZStop ; + } + + // Numero di voxel lungo Y + int nVoxNumY = int( m_nNy[0] / N_DEXVOXRATIO + ( m_nNy[0] % N_DEXVOXRATIO == 0 ? 1 : 2)) ; + + int nMinJ = Clamp( int( floor( ( ( dMin - 0.5 * m_dStep) / ( N_DEXVOXRATIO * m_dStep) - EPS_SMALL))), 0, nVoxNumY - 2) ; + int nMaxJ = Clamp( int( floor( ( ( dMax + 0.5 * m_dStep) / ( N_DEXVOXRATIO * m_dStep) + EPS_SMALL))), 0, nVoxNumY - 2) ; + + int nMinYBlock = Clamp( nMinJ / int( m_nVoxNumPerBlock), 0, int( m_nFracLin[1] - 1)) ; + int nMaxYBlock = min( int( m_nFracLin[1] - 1), nMaxJ / int( m_nVoxNumPerBlock)) ; + + for ( int tI = 0 ; tI < nZStop ; ++ tI) { + for ( int tJ = 0 ; tJ < nXStop ; ++ tJ) { + for ( int k = nMinYBlock ; k <= nMaxYBlock ; ++ k) { + int nBlockNum = nZBlock[tI] * nLayerBlock + k * m_nFracLin[0] + nXBlock[tJ] ; + m_BlockToUpdate[nBlockNum] = true ; + } + } + } + } + return true ; +} + //---------------------------------------------------------------------------- bool VolZmap::SetTolerances( double dLinTol, double dAngTolDeg) diff --git a/VolZmap.h b/VolZmap.h index 1e0e933..9c7af85 100644 --- a/VolZmap.h +++ b/VolZmap.h @@ -172,8 +172,7 @@ class VolZmap : public IVolZmap, public IGeoObjRW bool IsPointInsideVoxelApprox( int nI, int nJ, int nK, const Point3d& ptP, double dPrec = EPS_SMALL) const ; bool GetPointVoxel( const Point3d& ptP, int& nVoxI, int& nVoxJ, int& nVoxK) const ; bool IsZInsideInterval( int nGrid, int nDex, double dZ) const ; - bool GridControl( VectorField VecField[], VectorField CompoVert[][12], - int nIndArrey[][4], int nVertComp[], int nCompCount, bool& bGridControl) const ; + // OPERAZIONI SU INTERVALLI bool SubtractIntervals( unsigned int nGrid, unsigned int nI, unsigned int nJ, double dMin, double dMax, const Vector3d& vtNMin, const Vector3d& vtNMax) ; @@ -290,6 +289,7 @@ class VolZmap : public IVolZmap, public IGeoObjRW bool GetBlockNFromIJK( int nIJK[], int& nBlock) const ; bool GetBlockLimitsIJK( const int nIJK[], int nLimits[]) const ; bool GetVoxelBlockIJK( const int nVoxIJK[], int nBlockIJK[]) const ; + bool SetToModifyDexelBlocks( int nGrid, int nDex, int nInt) ; bool GetAdjBlockToBlock( int nBlockN, int nDeltaI, int nDeltaJ, int nDeltaK, int& nAdjBlockN) const ; bool IsAVoxelOnBoundary( const int nLimits[], const int nIJK[], bool bType) const ; bool IsATriangleOnBorder( const Triangle3dEx& trTria, const Point3d& ptVert, diff --git a/VolZmapGraphics.cpp b/VolZmapGraphics.cpp index bf9cd8b..60705ad 100644 --- a/VolZmapGraphics.cpp +++ b/VolZmapGraphics.cpp @@ -161,318 +161,6 @@ DotTest( const VectorField CompoVert[], int nCompoElem, Vector3d& vtAvg, double return true ; } -//---------------------------------------------------------------------------- -bool -VolZmap::GridControl( VectorField VecField[], VectorField CompoVert[][12], - int nIndArrey[][4], int nVertComp[], int nCompCount, bool& bGridControl) const -{ - // Ordino i 4 indici in senso crescente - for ( int nSrtInd1 = 0 ; nSrtInd1 < nVertComp[nCompCount - 1] - 1 ; ++ nSrtInd1) { - for ( int nSrtInd2 = nSrtInd1 + 1 ; nSrtInd2 < nVertComp[nCompCount - 1] ; ++ nSrtInd2) { - if ( nIndArrey[nCompCount - 1][nSrtInd1] > nIndArrey[nCompCount - 1][nSrtInd2]) - swap( nIndArrey[nCompCount - 1][nSrtInd1], nIndArrey[nCompCount - 1][nSrtInd2]) ; - } - } - - if ( ( nIndArrey[nCompCount - 1][0] == 0 && nIndArrey[nCompCount - 1][1] == 2 && - nIndArrey[nCompCount - 1][2] == 9 && nIndArrey[nCompCount - 1][3] == 10) || - ( nIndArrey[nCompCount - 1][0] == 4 && nIndArrey[nCompCount - 1][1] == 6 && - nIndArrey[nCompCount - 1][2] == 9 && nIndArrey[nCompCount - 1][3] == 10) || - ( nIndArrey[nCompCount - 1][0] == 4 && nIndArrey[nCompCount - 1][1] == 6 && - nIndArrey[nCompCount - 1][2] == 8 && nIndArrey[nCompCount - 1][3] == 11) || - ( nIndArrey[nCompCount - 1][0] == 0 && nIndArrey[nCompCount - 1][1] == 2 && - nIndArrey[nCompCount - 1][2] == 8 && nIndArrey[nCompCount - 1][3] == 11) || - ( nIndArrey[nCompCount - 1][0] == 1 && nIndArrey[nCompCount - 1][1] == 3 && - nIndArrey[nCompCount - 1][2] == 8 && nIndArrey[nCompCount - 1][3] == 9 ) || - ( nIndArrey[nCompCount - 1][0] == 1 && nIndArrey[nCompCount - 1][1] == 3 && - nIndArrey[nCompCount - 1][2] == 10 && nIndArrey[nCompCount - 1][3] == 11) || - ( nIndArrey[nCompCount - 1][0] == 5 && nIndArrey[nCompCount - 1][1] == 7 && - nIndArrey[nCompCount - 1][2] == 10 && nIndArrey[nCompCount - 1][3] == 11) || - ( nIndArrey[nCompCount - 1][0] == 5 && nIndArrey[nCompCount - 1][1] == 7 && - nIndArrey[nCompCount - 1][2] == 8 && nIndArrey[nCompCount - 1][3] == 9 )) { - - if ( AreSameVectorApprox( VecField[nIndArrey[nCompCount - 1][0]].vtNorm, VecField[nIndArrey[nCompCount - 1][1]].vtNorm) && - abs( VecField[nIndArrey[nCompCount - 1][0]].vtNorm * VecField[nIndArrey[nCompCount - 1][2]].vtNorm) < EPS_SMALL && - abs( VecField[nIndArrey[nCompCount - 1][0]].vtNorm * VecField[nIndArrey[nCompCount - 1][3]].vtNorm) < EPS_SMALL) { - - Point3d ptBarycenter = ( CompoVert[nCompCount - 1][0].ptInt + CompoVert[nCompCount - 1][1].ptInt + - CompoVert[nCompCount - 1][2].ptInt + CompoVert[nCompCount - 1][3].ptInt) / 4 ; - - Vector3d vtVecField = VecField[nIndArrey[nCompCount - 1][0]].vtNorm ; - - if ( vtVecField.x * vtVecField.x > 1 - EPS_SMALL * EPS_SMALL) { - if ( abs( CompoVert[nCompCount - 1][0].ptInt.x - ptBarycenter.x) < EPS_SMALL && - abs( CompoVert[nCompCount - 1][1].ptInt.x - ptBarycenter.x) < EPS_SMALL && - abs( CompoVert[nCompCount - 1][2].ptInt.x - ptBarycenter.x) < EPS_SMALL && - abs( CompoVert[nCompCount - 1][3].ptInt.x - ptBarycenter.x) < EPS_SMALL) { - double dXBar = ptBarycenter.x / m_dStep - 0.5 ; - int nBarLimSup = int( m_nNx[0]) ; - int nBarInd = 0 ; - while ( nBarInd < nBarLimSup) { - double dXInd = double( nBarInd) ; - if ( abs( dXInd - dXBar) < EPS_SMALL) { - bGridControl = false ; - break ; - } - ++ nBarInd ; - } - } - } - - else if ( vtVecField.y * vtVecField.y > 1 - EPS_SMALL * EPS_SMALL) { - if ( abs( CompoVert[nCompCount - 1][0].ptInt.y - ptBarycenter.y) < EPS_SMALL && - abs( CompoVert[nCompCount - 1][1].ptInt.y - ptBarycenter.y) < EPS_SMALL && - abs( CompoVert[nCompCount - 1][2].ptInt.y - ptBarycenter.y) < EPS_SMALL && - abs( CompoVert[nCompCount - 1][3].ptInt.y - ptBarycenter.y) < EPS_SMALL) { - double dYBar = ptBarycenter.y / m_dStep - 0.5 ; - int nBarLimSup = int( m_nNy[0]) ; - int nBarInd = 0 ; - while ( nBarInd < nBarLimSup) { - double dYInd = double( nBarInd) ; - if ( abs( dYInd - dYBar) < EPS_SMALL) { - bGridControl = false ; - break ; - } - ++ nBarInd ; - } - } - } - - else if ( vtVecField.z * vtVecField.z > 1 - EPS_SMALL * EPS_SMALL) { - if ( abs( CompoVert[nCompCount - 1][0].ptInt.z - ptBarycenter.z) < EPS_SMALL && - abs( CompoVert[nCompCount - 1][1].ptInt.z - ptBarycenter.z) < EPS_SMALL && - abs( CompoVert[nCompCount - 1][2].ptInt.z - ptBarycenter.z) < EPS_SMALL && - abs( CompoVert[nCompCount - 1][3].ptInt.z - ptBarycenter.z) < EPS_SMALL) { - double dZBar = ptBarycenter.z / m_dStep - 0.5 ; - int nBarLimSup = int( m_nNy[1]) ; - int nBarInd = 0 ; - while ( nBarInd < nBarLimSup) { - double dZInd = double( nBarInd) ; - if ( abs( dZInd - dZBar) < EPS_SMALL) { - bGridControl = false ; - break ; - } - ++ nBarInd ; - } - } - } - } - - else if ( AreSameVectorApprox( VecField[nIndArrey[nCompCount - 1][2]].vtNorm, VecField[nIndArrey[nCompCount - 1][3]].vtNorm) && - abs( VecField[nIndArrey[nCompCount - 1][2]].vtNorm * VecField[nIndArrey[nCompCount - 1][0]].vtNorm) < EPS_SMALL && - abs( VecField[nIndArrey[nCompCount - 1][2]].vtNorm * VecField[nIndArrey[nCompCount - 1][1]].vtNorm) < EPS_SMALL) { - - Point3d ptBarycenter = ( CompoVert[nCompCount - 1][0].ptInt + CompoVert[nCompCount - 1][1].ptInt + - CompoVert[nCompCount - 1][2].ptInt + CompoVert[nCompCount - 1][3].ptInt) / 4 ; - - Vector3d vtVecField = VecField[nIndArrey[nCompCount - 1][2]].vtNorm ; - - if ( vtVecField.x * vtVecField.x > 1 - EPS_SMALL * EPS_SMALL) { - if ( abs( CompoVert[nCompCount - 1][0].ptInt.x - ptBarycenter.x) < EPS_SMALL && - abs( CompoVert[nCompCount - 1][1].ptInt.x - ptBarycenter.x) < EPS_SMALL && - abs( CompoVert[nCompCount - 1][2].ptInt.x - ptBarycenter.x) < EPS_SMALL && - abs( CompoVert[nCompCount - 1][3].ptInt.x - ptBarycenter.x) < EPS_SMALL) { - double dXBar = ptBarycenter.x / m_dStep - 0.5 ; - int nBarLimSup = int( m_nNx[0]) ; - int nBarInd = 0 ; - while ( nBarInd < nBarLimSup) { - double dXInd = double( nBarInd) ; - if ( abs( dXInd - dXBar) < EPS_SMALL) { - bGridControl = false ; - break ; - } - ++ nBarInd ; - } - } - } - - else if ( vtVecField.y * vtVecField.y > 1 - EPS_SMALL * EPS_SMALL) { - if ( abs( CompoVert[nCompCount - 1][0].ptInt.y - ptBarycenter.y) < EPS_SMALL && - abs( CompoVert[nCompCount - 1][1].ptInt.y - ptBarycenter.y) < EPS_SMALL && - abs( CompoVert[nCompCount - 1][2].ptInt.y - ptBarycenter.y) < EPS_SMALL && - abs( CompoVert[nCompCount - 1][3].ptInt.y - ptBarycenter.y) < EPS_SMALL) { - double dYBar = ptBarycenter.y / m_dStep - 0.5 ; - int nBarLimSup = int( m_nNy[0]) ; - int nBarInd = 0 ; - while ( nBarInd < nBarLimSup) { - double dYInd = double( nBarInd) ; - if ( abs( dYInd - dYBar) < EPS_SMALL) { - bGridControl = false ; - break ; - } - ++ nBarInd ; - } - } - } - - else if ( vtVecField.z * vtVecField.z > 1 - EPS_SMALL * EPS_SMALL) { - if ( abs( CompoVert[nCompCount - 1][0].ptInt.z - ptBarycenter.z) < EPS_SMALL && - abs( CompoVert[nCompCount - 1][1].ptInt.z - ptBarycenter.z) < EPS_SMALL && - abs( CompoVert[nCompCount - 1][2].ptInt.z - ptBarycenter.z) < EPS_SMALL && - abs( CompoVert[nCompCount - 1][3].ptInt.z - ptBarycenter.z) < EPS_SMALL) { - double dZBar = ptBarycenter.z / m_dStep - 0.5 ; - int nBarLimSup = int( m_nNy[1]) ; - int nBarInd = 0 ; - while ( nBarInd < nBarLimSup) { - double dZInd = double( nBarInd) ; - if ( abs( dZInd - dZBar) < EPS_SMALL) { - bGridControl = false ; - break ; - } - ++ nBarInd ; - } - } - } - } - } - - else if ( ( nIndArrey[nCompCount - 1][0] == 0 && nIndArrey[nCompCount - 1][1] == 1 && - nIndArrey[nCompCount - 1][2] == 4 && nIndArrey[nCompCount - 1][3] == 5) || - ( nIndArrey[nCompCount - 1][0] == 1 && nIndArrey[nCompCount - 1][1] == 2 && - nIndArrey[nCompCount - 1][2] == 5 && nIndArrey[nCompCount - 1][3] == 6) || - ( nIndArrey[nCompCount - 1][0] == 2 && nIndArrey[nCompCount - 1][1] == 3 && - nIndArrey[nCompCount - 1][2] == 6 && nIndArrey[nCompCount - 1][3] == 7) || - ( nIndArrey[nCompCount - 1][0] == 0 && nIndArrey[nCompCount - 1][1] == 3 && - nIndArrey[nCompCount - 1][2] == 4 && nIndArrey[nCompCount - 1][3] == 7)) { - - if ( AreSameVectorApprox( VecField[nIndArrey[nCompCount - 1][0]].vtNorm, VecField[nIndArrey[nCompCount - 1][2]].vtNorm) && - abs( VecField[nIndArrey[nCompCount - 1][0]].vtNorm * VecField[nIndArrey[nCompCount - 1][1]].vtNorm) < EPS_SMALL && - abs( VecField[nIndArrey[nCompCount - 1][0]].vtNorm * VecField[nIndArrey[nCompCount - 1][3]].vtNorm) < EPS_SMALL) { - - Point3d ptBarycenter = ( CompoVert[nCompCount - 1][0].ptInt + CompoVert[nCompCount - 1][1].ptInt + - CompoVert[nCompCount - 1][2].ptInt + CompoVert[nCompCount - 1][3].ptInt) / 4 ; - - Vector3d vtVecField = VecField[nIndArrey[nCompCount - 1][0]].vtNorm ; - - if ( vtVecField.x * vtVecField.x > 1 - EPS_SMALL * EPS_SMALL) { - if ( abs( CompoVert[nCompCount - 1][0].ptInt.x - ptBarycenter.x) < EPS_SMALL && - abs( CompoVert[nCompCount - 1][1].ptInt.x - ptBarycenter.x) < EPS_SMALL && - abs( CompoVert[nCompCount - 1][2].ptInt.x - ptBarycenter.x) < EPS_SMALL && - abs( CompoVert[nCompCount - 1][3].ptInt.x - ptBarycenter.x) < EPS_SMALL) { - double dXBar = ptBarycenter.x / m_dStep - 0.5 ; - int nBarLimSup = int( m_nNx[0]) ; - int nBarInd = 0 ; - while ( nBarInd < nBarLimSup) { - double dXInd = double( nBarInd) ; - if ( abs( dXInd - dXBar) < EPS_SMALL) { - bGridControl = false ; - break ; - } - ++ nBarInd ; - } - } - } - - else if ( vtVecField.y * vtVecField.y > 1 - EPS_SMALL * EPS_SMALL) { - if ( abs( CompoVert[nCompCount - 1][0].ptInt.y - ptBarycenter.y) < EPS_SMALL && - abs( CompoVert[nCompCount - 1][1].ptInt.y - ptBarycenter.y) < EPS_SMALL && - abs( CompoVert[nCompCount - 1][2].ptInt.y - ptBarycenter.y) < EPS_SMALL && - abs( CompoVert[nCompCount - 1][3].ptInt.y - ptBarycenter.y) < EPS_SMALL) { - double dYBar = ptBarycenter.y / m_dStep - 0.5 ; - int nBarLimSup = int( m_nNy[0]) ; - int nBarInd = 0 ; - while ( nBarInd < nBarLimSup) { - double dYInd = double( nBarInd) ; - if ( abs( dYInd - dYBar) < EPS_SMALL) { - bGridControl = false ; - break ; - } - ++ nBarInd ; - } - } - } - - else if ( vtVecField.z * vtVecField.z > 1 - EPS_SMALL * EPS_SMALL) { - if ( abs( CompoVert[nCompCount - 1][0].ptInt.z - ptBarycenter.z) < EPS_SMALL && - abs( CompoVert[nCompCount - 1][1].ptInt.z - ptBarycenter.z) < EPS_SMALL && - abs( CompoVert[nCompCount - 1][2].ptInt.z - ptBarycenter.z) < EPS_SMALL && - abs( CompoVert[nCompCount - 1][3].ptInt.z - ptBarycenter.z) < EPS_SMALL) { - double dZBar = ptBarycenter.z / m_dStep - 0.5 ; - int nBarLimSup = int( m_nNy[1]) ; - int nBarInd = 0 ; - while ( nBarInd < nBarLimSup) { - double dZInd = double( nBarInd) ; - if ( abs( dZInd - dZBar) < EPS_SMALL) { - bGridControl = false ; - break ; - } - ++ nBarInd ; - } - } - } - } - - else if ( AreSameVectorApprox( VecField[nIndArrey[nCompCount - 1][1]].vtNorm, VecField[nIndArrey[nCompCount - 1][3]].vtNorm) && - abs( VecField[nIndArrey[nCompCount - 1][1]].vtNorm * VecField[nIndArrey[nCompCount - 1][0]].vtNorm) < EPS_SMALL && - abs( VecField[nIndArrey[nCompCount - 1][1]].vtNorm * VecField[nIndArrey[nCompCount - 1][2]].vtNorm) < EPS_SMALL) { - - Point3d ptBarycenter = ( CompoVert[nCompCount - 1][0].ptInt + CompoVert[nCompCount - 1][1].ptInt + - CompoVert[nCompCount - 1][2].ptInt + CompoVert[nCompCount - 1][3].ptInt) / 4 ; - - Vector3d vtVecField = VecField[nIndArrey[nCompCount - 1][0]].vtNorm ; - - if ( vtVecField.x * vtVecField.x > 1 - EPS_SMALL * EPS_SMALL) { - if ( abs( CompoVert[nCompCount - 1][0].ptInt.x - ptBarycenter.x) < EPS_SMALL && - abs( CompoVert[nCompCount - 1][1].ptInt.x - ptBarycenter.x) < EPS_SMALL && - abs( CompoVert[nCompCount - 1][2].ptInt.x - ptBarycenter.x) < EPS_SMALL && - abs( CompoVert[nCompCount - 1][3].ptInt.x - ptBarycenter.x) < EPS_SMALL) { - double dXBar = ptBarycenter.x / m_dStep - 0.5 ; - int nBarLimSup = int( m_nNx[0]) ; - int nBarInd = 0 ; - while ( nBarInd < nBarLimSup) { - double dXInd = double( nBarInd) ; - if ( abs( dXInd - dXBar) < EPS_SMALL) { - bGridControl = false ; - break ; - } - ++ nBarInd ; - } - } - } - - else if ( vtVecField.y * vtVecField.y > 1 - EPS_SMALL * EPS_SMALL) { - if ( abs( CompoVert[nCompCount - 1][0].ptInt.y - ptBarycenter.y) < EPS_SMALL && - abs( CompoVert[nCompCount - 1][1].ptInt.y - ptBarycenter.y) < EPS_SMALL && - abs( CompoVert[nCompCount - 1][2].ptInt.y - ptBarycenter.y) < EPS_SMALL && - abs( CompoVert[nCompCount - 1][3].ptInt.y - ptBarycenter.y) < EPS_SMALL) { - double dYBar = ptBarycenter.y / m_dStep - 0.5 ; - int nBarLimSup = int( m_nNy[0]) ; - int nBarInd = 0 ; - while ( nBarInd < nBarLimSup) { - double dYInd = double( nBarInd) ; - if ( abs( dYInd - dYBar) < EPS_SMALL) { - bGridControl = false ; - break ; - } - ++ nBarInd ; - } - } - } - - else if ( vtVecField.z * vtVecField.z > 1 - EPS_SMALL * EPS_SMALL) { - if ( abs( CompoVert[nCompCount - 1][0].ptInt.z - ptBarycenter.z) < EPS_SMALL && - abs( CompoVert[nCompCount - 1][1].ptInt.z - ptBarycenter.z) < EPS_SMALL && - abs( CompoVert[nCompCount - 1][2].ptInt.z - ptBarycenter.z) < EPS_SMALL && - abs( CompoVert[nCompCount - 1][3].ptInt.z - ptBarycenter.z) < EPS_SMALL) { - double dZBar = ptBarycenter.z / m_dStep - 0.5 ; - int nBarLimSup = int( m_nNy[1]) ; - int nBarInd = 0 ; - while ( nBarInd < nBarLimSup) { - double dZInd = double( nBarInd) ; - if ( abs( dZInd - dZBar) < EPS_SMALL) { - bGridControl = false ; - break ; - } - ++ nBarInd ; - } - } - } - } - } - - return true ; -} - // ------------------------- VISUALIZZAZIONE -------------------------------------------------------------------------------------- //---------------------------------------------------------------------------- bool @@ -1245,17 +933,9 @@ VolZmap::ProcessCube( int nVoxI, int nVoxJ, int nVoxK, TRIA3DEXLIST& lstTria, Tr // Se i componenti sono regolari valuto le normali per stabilire se eseguire ExtMC o MC if ( bReg) nFeatureType = TestOnNormal( CompoVert[nCompCount - 1], nVertComp[nCompCount - 1]) ; - - // Controllo per il caso piano su una griglia - // con versori normali a due a due paralleli. - bool bGridControl = true ; - if ( nFeatureType != NO_FEATURE) { - if ( nVertComp[nCompCount - 1] == 4) - GridControl( VecField, CompoVert, nIndArrey, nVertComp, nCompCount, bGridControl) ; - } // Flag ExtMC - bool bExtMC = ( nFeatureType != NO_FEATURE && bGridControl) && ( ! bSecondConfig6) && bEnh ; + bool bExtMC = ( nFeatureType != NO_FEATURE) && ( ! bSecondConfig6) && bEnh ; // Extended MC if ( bExtMC) { @@ -1993,13 +1673,8 @@ VolZmap::ExtMarchingCubes( int nBlock, TRIA3DEXLIST& lstTria, TriHolder& triHold if ( bReg) nFeatureType = TestOnNormal( CompoVert[nCompCount - 1], nVertComp[nCompCount - 1]) ; - // Controllo per il caso piano su una griglia con versori normali a due a due paralleli - bool bGridControl = true ; - if ( nFeatureType != NO_FEATURE && nVertComp[nCompCount - 1] == 4) - GridControl( VecField, CompoVert, nIndArrey, nVertComp, nCompCount, bGridControl) ; - // Flag ExtMC - bool bExtMC = ( nFeatureType != NO_FEATURE /*&& bGridControl*/) ; + bool bExtMC = ( nFeatureType != NO_FEATURE) ; // Extended MC if ( bExtMC) { diff --git a/VolZmapVolume.cpp b/VolZmapVolume.cpp index 297ce42..9ff601c 100644 --- a/VolZmapVolume.cpp +++ b/VolZmapVolume.cpp @@ -1675,7 +1675,7 @@ VolZmap::Mrt_ZDrilling( unsigned int nGrid, const Point3d& ptS, const Point3d& p Point3d ptCylS = ptS - dLenZ * vtToolDir + 0.5 * dLenY * vtAux ; Point3d ptCylE = ptEOnP - dLenZ * vtToolDir + 0.5 * dLenY * vtAux ; - CompCyl_ZMilling( nGrid, ptCylS, ptCylE, vtAux, dLenY, m_Tool.GetCornRadius()) ; + CompCyl_Milling( nGrid, ptCylS, ptCylE, vtAux, dLenY, m_Tool.GetCornRadius(), false, false) ; } return true ; @@ -1726,7 +1726,7 @@ VolZmap::Mrt_ZMilling( unsigned int nGrid, const Point3d& ptS, const Point3d& pt Point3d ptCylS = ptPlS - dLenZ * vtToolDir + 0.5 * dLenY * vtAux ; Point3d ptCylE = ptPlE - dLenZ * vtToolDir + 0.5 * dLenY * vtAux ; - CompCyl_ZMilling( nGrid, ptCylS, ptCylE, vtAux, dLenY, m_Tool.GetCornRadius()) ; + CompCyl_Milling( nGrid, ptCylS, ptCylE, vtAux, dLenY, m_Tool.GetCornRadius(), false, false) ; } return true ;