diff --git a/VolZmap.h b/VolZmap.h index a3bfbf8..0d8ad94 100644 --- a/VolZmap.h +++ b/VolZmap.h @@ -362,7 +362,7 @@ class VolZmap : public IVolZmap, public IGeoObjRW Point3d& ptInt1, Vector3d& vtN1, Point3d& ptInt2, Vector3d& vtN2) const ; bool IntersLineMyPolyhedron( const Point3d& ptLineSt, const Vector3d& vtLineDir, const Frame3d& PolyFrame, double dLenX, double dLenY, double dLenZ, double dDeltaX, - Point3d& ptInt1, Vector3d& vtN1, Point3d& ptInt2, Vector3d& vtN2) const ; + Point3d& ptInt1, Vector3d& vtN1, Point3d& ptInt2, Vector3d& vtN2, bool bSubtracting = true) const ; bool IntersLineTruncatedPyramid( const Point3d& ptLineSt, const Vector3d& vtLineDir, const Frame3d& frTruncPyramFrame, double dSegMin, double dSegMax, double dHeight, Point3d& ptInt1, Vector3d& vtN1, Point3d& ptInt2, Vector3d& vtN2) const ; diff --git a/VolZmapCalculus.cpp b/VolZmapCalculus.cpp index 9f4f8cd..c494902 100644 --- a/VolZmapCalculus.cpp +++ b/VolZmapCalculus.cpp @@ -2681,7 +2681,7 @@ VolZmap::IntersLineEllipticalCylinder( const Point3d& ptLineSt, const Vector3d& bool VolZmap::IntersLineMyPolyhedron( const Point3d& ptLineSt, const Vector3d& vtLineDir, const Frame3d& PolyFrame, double dLenX, double dLenY, double dLenZ, double dDeltaZ, - Point3d& ptInt1, Vector3d& vtN1, Point3d& ptInt2, Vector3d& vtN2) const + Point3d& ptInt1, Vector3d& vtN1, Point3d& ptInt2, Vector3d& vtN2, bool bSubtracting) const { // Controllo sulle dimensioni lineari affinché sia valido il poliedro if ( dLenX <= EPS_SMALL || dLenY <= EPS_SMALL || dLenZ <= EPS_SMALL) @@ -2705,17 +2705,19 @@ VolZmap::IntersLineMyPolyhedron( const Point3d& ptLineSt, const Vector3d& vtLine // Controlli affinché non vengano tagliati dexel a filo // con il passaggio dell'utensile: - // Controllo sulle facce 1 e 2 - if ( abs( vtV.y) < EPS_ZERO && abs( ptP.y) > ptFacet135.y) - return false ; - // Controllo sulle facce 3 e 4 - if ( abs( vtV.x) < EPS_ZERO && ( ptP.x < ptFacet135.x || ptP.x > ptFacet246.x)) - return false ; - // Controllo sulle facce 5 e 6 - double dP1 = abs ( ( ptFacet135 - ptP) * vtOb) ; - double dP2 = abs ( ( ptFacet246 - ptP) * vtOb) ; - if ( abs( vtV * vtOb) < EPS_ZERO && ( dP1 < EPS_SMALL || dP2 < EPS_SMALL)) - return false ; + if ( bSubtracting) { + // Controllo sulle facce 1 e 2 + if ( abs( vtV.y) < EPS_ZERO && abs( ptP.y) > ptFacet135.y) + return false ; + // Controllo sulle facce 3 e 4 + if ( abs( vtV.x) < EPS_ZERO && ( ptP.x < ptFacet135.x || ptP.x > ptFacet246.x)) + return false ; + // Controllo sulle facce 5 e 6 + double dP1 = abs ( ( ptFacet135 - ptP) * vtOb) ; + double dP2 = abs ( ( ptFacet246 - ptP) * vtOb) ; + if ( abs( vtV * vtOb) < EPS_ZERO && ( dP1 < EPS_SMALL || dP2 < EPS_SMALL)) + return false ; + } // Punti notevoli Point3d ptI1 = ptP + ( ( ptFacet135.y - ptP.y) / vtV.y) * vtV ; diff --git a/VolZmapVolume.cpp b/VolZmapVolume.cpp index b21a60b..b06ca0f 100644 --- a/VolZmapVolume.cpp +++ b/VolZmapVolume.cpp @@ -737,6 +737,9 @@ VolZmap::MillingTranslationStep( const Point3d& ptPs, const Point3d& ptPe, const Vector3d vtALs[N_MAPS] ; InitializePointsAndVectors( ptPs, ptPe, vtD, vtA, ptLs, ptLe, vtLs, vtALs) ; // Ciclo sulle mappe + /*for ( int i = 0 ; i < m_nMapNum ; ++ i) { + SelectMotion( i, ptLs[i], ptLe[i], vtLs[i], vtALs[i]) ; + }*/ vector< future> vRes ; vRes.resize( m_nMapNum) ; for ( int i = 0 ; i < m_nMapNum ; ++ i) { @@ -7833,23 +7836,24 @@ VolZmap::AddingMotion( int nGrid, const Point3d& ptS, const Point3d& ptE, const double dX1 = vtStC * vtV1 ; double dX2 = vtStC * vtV2 ; - if ( ( dX1 > 0 && dX1 < dLen1 && abs( dX2) < dRad) || - vtStC.SqLen() < dRad * dRad || - vtEnC.SqLen() < dRad * dRad) { + if ( ( dX1 > 0 && dX1 < dLen1 && abs( dX2) < dRad + EPS_SMALL) || + vtStC.SqLen() < dRad * dRad + 2 * dRad * EPS_SMALL || + vtEnC.SqLen() < dRad * dRad + 2 * dRad * EPS_SMALL) { AddIntervals( nGrid, i, j, ptS.z - dHei, ptS.z, - Z_AX, Z_AX) ; } } } } else { + double dMyTol = 0/*EPS_SMALL*/; Frame3d CylFrame, PolyFrame ; CylFrame.Set( ptS - dHei * vtAx, vtAx) ; - PolyFrame.Set( ptS - ( dHei + EPS_SMALL) * vtAx, vtV1, vtAx ^ vtV1, vtAx) ; + PolyFrame.Set( ptS - ( dHei + dMyTol) * vtAx, vtV1, vtAx ^ vtV1, vtAx) ; for ( int i = nStartI ; i <= nEndI ; ++ i) { for ( int j = nStartJ ; j <= nEndJ ; ++ j) { Point3d ptC( ( i + 0.5) * m_dStep, ( j + 0.5) * m_dStep, 0) ; - + Point3d ptInt1, ptInt2 ; Vector3d vtN1, vtN2 ; @@ -7863,8 +7867,8 @@ VolZmap::AddingMotion( int nGrid, const Point3d& ptS, const Point3d& ptE, const AddIntervals( nGrid, i, j, ptInt1.z + dLen1 * vtV1.z, ptInt2.z + dLen1 * vtV1.z, - vtN1, - vtN2) ; } - if ( IntersLineMyPolyhedron( ptC, Z_AX, PolyFrame, dLen1, 2 * ( dRad + EPS_SMALL), dHei + 2 * EPS_SMALL, 0, - ptInt1, vtN1, ptInt2, vtN2)) { + if ( IntersLineMyPolyhedron( ptC, Z_AX, PolyFrame, dLen1, 2 * ( dRad + dMyTol), dHei + 2 * dMyTol, 0, + ptInt1, vtN1, ptInt2, vtN2, false)) { AddIntervals( nGrid, i, j, ptInt1.z, ptInt2.z, - vtN1, - vtN2) ; } }