diff --git a/VolTriZmapCalculus.cpp b/VolTriZmapCalculus.cpp index 5d3896e..e062f18 100644 --- a/VolTriZmapCalculus.cpp +++ b/VolTriZmapCalculus.cpp @@ -991,11 +991,27 @@ VolZmap::IntersLineMyPolyhedron( const Point3d& ptLineSt, const Vector3d& vtLine Point3d ptI5 = ptP + ( ( vtFacet5 * vtOb) / ( vtV * vtOb)) * vtV ; Point3d ptI6 = ptP + ( ( vtFacet6 * vtOb) / ( vtV * vtOb)) * vtV ; - if ( abs( vtV.z) < EPS_ZERO && - abs( ptP.z) > dLenZ / 2 - EPS_SMALL) - + // Controlli affinché non vengano tagliati dexel a filo + // con il passaggio dell'utensile: + // Controllo sulle facce 1 e 2 + if ( abs( vtV.z) < EPS_ZERO && + abs( ptP.z) > dLenZ / 2 - EPS_SMALL) + return false ; + // Controllo sulle facce 3 e 4 + if ( abs( vtV.y) < EPS_ZERO && + ( ptP.y < EPS_SMALL || + ptP.y > dLenY - EPS_SMALL)) + return false ; + // Controllo sulle facce 5 e 6 + Vector3d vtW( dDeltaX, dLenY, 0) ; + vtW.Normalize() ; + Vector3d vtU = vtV - vtV.z * Z_AX - vtV * vtW * vtW ; + if ( vtU.Len() < EPS_ZERO && + ( ptP.x * dLenY < dDeltaX * ptP.y + dLenY * EPS_SMALL || + ptP.x * dLenY > dDeltaX * ptP.y + dLenY * ( dLenX - EPS_SMALL))) return false ; + // Ricerca intersezioni con le facce int nIntNum = 0 ; // Intersezione con la prima faccia diff --git a/VolTriZmapVolume.cpp b/VolTriZmapVolume.cpp index 059f16e..5c83a69 100644 --- a/VolTriZmapVolume.cpp +++ b/VolTriZmapVolume.cpp @@ -3215,6 +3215,8 @@ VolZmap::Mrt_Milling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE dLenZ = m_dRCorner ; Vector3d vtVOnP = vtToolDir ^ vtAux ; + if ( vtVOnP * ( ptTipE - ptTipS) < 0) + vtVOnP *= - 1 ; // Cilindri Point3d ptSminus = ptTipS - ( 0.5 * dLenX) * vtVOnP + 0.5 * dLenY * vtAux ; @@ -3241,7 +3243,11 @@ VolZmap::Mrt_Milling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE //---------------------------------------------------------------------------- bool VolZmap::Chs_Drilling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir, const Vector3d& vtAux) -{ +{ + // Proiezione della traiettoria sulla varietà del movimento + Point3d ptProjE = ptS + ( ptE - ptS) * vtToolDir * vtToolDir ; + + CompPar_Drilling( nGrid, m_dMrtChsWidth, m_dMrtChsThickness, m_dHeight, ptS, ptProjE, vtToolDir, vtAux) ; return true ; } @@ -3254,7 +3260,9 @@ VolZmap::Chs_Milling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE // Proiezione della traiettoria sul piano dei movimenti possibili Point3d ptSp = ptS ; Vector3d vtMoveOnP = ( ptE - ptS) - ( ptE - ptS) * vtToolDir * vtToolDir ; - Point3d pEp = ptS + vtMoveOnP ; + Point3d ptProjE = ptS + vtMoveOnP ; + + CompPar_Milling( nGrid, m_dMrtChsWidth, m_dMrtChsThickness, m_dHeight, ptS, ptProjE, vtToolDir, vtAux) ; return true ; } @@ -4680,7 +4688,7 @@ VolZmap::CompCyl_Milling( unsigned int nGrid, const Point3d& ptS, const Point3d& for ( unsigned int i = nStartI ; i <= nEndI ; ++ i) { for ( unsigned int j = nStartJ ; j <= nEndJ ; ++ j) { - + Point3d ptC( ( i + 0.5) * m_dStep, ( j + 0.5) * m_dStep, 0) ; Point3d ptInt1, ptInt2 ;