diff --git a/IntersPlaneVolZmap.cpp b/IntersPlaneVolZmap.cpp index 9f6e0a2..ad99de2 100644 --- a/IntersPlaneVolZmap.cpp +++ b/IntersPlaneVolZmap.cpp @@ -19,7 +19,7 @@ using namespace std ; //---------------------------------------------------------------------------- -// Intersezione di unpiano con la superficie di un solido VolZmap +// Intersezione di un piano con la superficie di un solido VolZmap //---------------------------------------------------------------------------- bool IntersPlaneVolZmap( const Plane3d& plPlane, const IVolZmap& Vzm, ICURVEPOVECTOR& vpLoop) @@ -28,9 +28,6 @@ IntersPlaneVolZmap( const Plane3d& plPlane, const IVolZmap& Vzm, ICURVEPOVECTOR& const VolZmap* pVzm = GetBasicVolZmap( &Vzm) ; if ( pVzm == nullptr) return false ; - // verifico parametro di ritorno - if ( &vpLoop == nullptr) - return false ; // eseguo intersezione return pVzm->GetPlaneIntersection( plPlane, vpLoop) ; diff --git a/VolZmap.cpp b/VolZmap.cpp index fdc44d8..c435347 100644 --- a/VolZmap.cpp +++ b/VolZmap.cpp @@ -507,11 +507,15 @@ VolZmap::GetLocalBBox( BBox3d& b3Loc, int nFlag) const } // passo al punto successivo dX += m_dStep ; + if ( m_nMapNum == N_MAPS) + dX = min( dX, m_dMaxZ[1]) ; } // passo alla riga successiva dY += m_dStep ; + if ( m_nMapNum == N_MAPS) + dY = min( dY, m_dMaxZ[2]) ; } -// + return true ; } @@ -551,9 +555,13 @@ VolZmap::GetBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag) const } // passo al punto successivo dX += m_dStep ; + if ( m_nMapNum == N_MAPS) + dX = min( dX, m_dMaxZ[1]) ; } // passo alla riga successiva dY += m_dStep ; + if ( m_nMapNum == N_MAPS) + dY = min( dY, m_dMaxZ[2]) ; } return true ; diff --git a/VolZmapCalculus.cpp b/VolZmapCalculus.cpp index 408593a..178f2ae 100644 --- a/VolZmapCalculus.cpp +++ b/VolZmapCalculus.cpp @@ -3080,17 +3080,18 @@ VolZmap::GetPlaneIntersection( const Plane3d& plPlane, ICURVEPOVECTOR& vpLoop) c return false ; // Se c'è intersezione valuto tutti i voxel interni if ( TestIntersPlaneBox( plPlaneLoc, b3BlockBox)) { - // Ciclo sui voxel del blocco. // Triangoli smooth - for ( int nV = 0 ; nV < int( m_BlockSmoothTria[nB].size()) ; ++ nV) { + // ciclo sui voxel del blocco. + for ( int nV = 0 ; nV < ssize( m_BlockSmoothTria[nB]) ; ++ nV) { // Box del voxel BBox3d b3Vox ; GetVoxelBox( m_BlockSmoothTria[nB][nV].i, m_BlockSmoothTria[nB][nV].j, m_BlockSmoothTria[nB][nV].k, b3Vox) ; - // Se non c'è intersezione col voxel, passo al successivo. + // Se non c'è intersezione col voxel, passo al successivo. if ( ! TestIntersPlaneBox( plPlaneLoc, b3Vox)) continue ; - for ( int nT = 0 ; nT < int( m_BlockSmoothTria[nB][nV].vTria.size()) ; ++ nT) { - Triangle3d trTria = m_BlockSmoothTria[nB][nV].vTria[nT] ; + // ciclo sui triangoli del voxel + for ( int nT = 0 ; nT < ssize( m_BlockSmoothTria[nB][nV].vTria) ; ++ nT) { + const Triangle3d& trTria = m_BlockSmoothTria[nB][nV].vTria[nT] ; Point3d ptSt, ptEn ; int nIntersType = IntersPlaneTria( plPlane, trTria, ptSt, ptEn) ; if ( nIntersType == IPTT_EDGE || nIntersType == IPTT_YES) { @@ -3102,18 +3103,18 @@ VolZmap::GetPlaneIntersection( const Plane3d& plPlane, ICURVEPOVECTOR& vpLoop) c } } // Triangoli sharp interni al blocco - for ( int nV = 0 ; nV < int( m_BlockSharpTria[nB].size()) ; ++ nV) { + // ciclo sui voxel del blocco. + for ( int nV = 0 ; nV < ssize( m_BlockSharpTria[nB]) ; ++ nV) { // Box del voxel BBox3d b3Vox ; GetVoxelBox( m_BlockSharpTria[nB][nV].i, m_BlockSharpTria[nB][nV].j, m_BlockSharpTria[nB][nV].k, b3Vox) ; - // Se non c'è intersezione col voxel, passo al successivo. // Ciclo sulle componenti connesse - for ( int nC = 0 ; nC < int( m_BlockSharpTria[nB][nV].vCompoTria.size()) ; ++ nC) { - for ( int nT = 0 ; nT < int( m_BlockSharpTria[nB][nV].vCompoTria[nC].size()) ; ++ nT) { - Triangle3d trTria = m_BlockSharpTria[nB][nV].vCompoTria[nC][nT] ; + for ( int nC = 0 ; nC < ssize( m_BlockSharpTria[nB][nV].vCompoTria) ; ++ nC) { + for ( int nT = 0 ; nT < ssize( m_BlockSharpTria[nB][nV].vCompoTria[nC]) ; ++ nT) { + const Triangle3d& trTria = m_BlockSharpTria[nB][nV].vCompoTria[nC][nT] ; Point3d ptSt, ptEn ; - int nIntersType = IntersPlaneTria(plPlane, trTria, ptSt, ptEn) ; - if (nIntersType == IPTT_EDGE || nIntersType == IPTT_YES) { + int nIntersType = IntersPlaneTria( plPlane, trTria, ptSt, ptEn) ; + if ( nIntersType == IPTT_EDGE || nIntersType == IPTT_YES) { // Costruisco il tratto di curva CurveLine cvLine ; if ( cvLine.Set(ptSt, ptEn)) @@ -3123,10 +3124,10 @@ VolZmap::GetPlaneIntersection( const Plane3d& plPlane, ICURVEPOVECTOR& vpLoop) c } } // Triangoli grandi del blocco - for ( int nT = 0 ; nT < int( m_BlockBigTria[nB].size()) ; ++ nT) { - Triangle3d trTria = m_BlockBigTria[nB][nT] ; + for ( int nT = 0 ; nT < ssize( m_BlockBigTria[nB]) ; ++ nT) { + const Triangle3d& trTria = m_BlockBigTria[nB][nT] ; Point3d ptSt, ptEn ; - int nIntersType = IntersPlaneTria(plPlane, trTria, ptSt, ptEn) ; + int nIntersType = IntersPlaneTria( plPlane, trTria, ptSt, ptEn) ; if ( nIntersType == IPTT_EDGE || nIntersType == IPTT_YES) { // Costruisco il tratto di curva CurveLine cvLine ; @@ -3136,11 +3137,11 @@ VolZmap::GetPlaneIntersection( const Plane3d& plPlane, ICURVEPOVECTOR& vpLoop) c } } // In ogni caso valuto i triangoli sharp fra blocchi - for ( int nV = 0 ; nV < int( m_InterBlockSharpTria[nB].size()) ; ++ nV) { + for ( int nV = 0 ; nV < ssize( m_InterBlockSharpTria[nB]) ; ++ nV) { // Ciclo sulle componenti connesse - for ( int nC = 0 ; nC < int( m_InterBlockSharpTria[nB][nV].vCompoTria.size()) ; ++ nC) { - for ( int nT = 0 ; nT < int( m_InterBlockSharpTria[nB][nV].vCompoTria[nC].size()) ; ++ nT) { - Triangle3d trTria = m_InterBlockSharpTria[nB][nV].vCompoTria[nC][nT] ; + for ( int nC = 0 ; nC < ssize( m_InterBlockSharpTria[nB][nV].vCompoTria) ; ++ nC) { + for ( int nT = 0 ; nT < ssize( m_InterBlockSharpTria[nB][nV].vCompoTria[nC]) ; ++ nT) { + const Triangle3d& trTria = m_InterBlockSharpTria[nB][nV].vCompoTria[nC][nT] ; Point3d ptSt, ptEn ; int nIntersType = IntersPlaneTria( plPlane, trTria, ptSt, ptEn) ; if ( nIntersType == IPTT_EDGE || nIntersType == IPTT_YES) { @@ -3156,9 +3157,9 @@ VolZmap::GetPlaneIntersection( const Plane3d& plPlane, ICURVEPOVECTOR& vpLoop) c // Creo i loop ChainCurves LoopCreator ; - LoopCreator.Init( false, EPS_SMALL, int( vLine.size())) ; + LoopCreator.Init( false, EPS_SMALL, ssize( vLine)) ; // Carico le curve per concatenarle - for ( int nCv = 0 ; nCv < int( vLine.size()) ; ++ nCv) { + for ( int nCv = 0 ; nCv < ssize( vLine) ; ++ nCv) { Point3d ptSt = vLine[nCv].GetStart() ; Point3d ptEn = vLine[nCv].GetEnd() ; Vector3d vtDir; vLine[nCv].GetStartDir(vtDir) ;