Modifiche asportazioni volumi avanzate

This commit is contained in:
LorenzoM
2021-07-23 09:03:28 +02:00
parent a2325a266f
commit 9c4118209e
2 changed files with 64 additions and 14 deletions
+59 -14
View File
@@ -5050,6 +5050,50 @@ VolZmap::IntersLineSphereCuttedByPlanes( const Point3d& ptLineP, const Vector3d&
return nSol ;
}
// Corona circolare
//----------------------------------------------------------------------------
bool
VolZmap::SurfCircCrown_ZDrilling( int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtAx, double dMaxRad, double dMinRad)
{
// Verifica sull'interferenza utensile Zmap
int nStartI, nStartJ, nEndI, nEndJ ;
if ( ! TestCompoBBox( nGrid, ptS, ptE, vtToolDir, dMaxRad, dMinRad, 1, nStartI, nStartJ, nEndI, nEndJ))
return true ;
// Se il movimento è in direzione opposta a quella ove la corona può tagliare, non devo fare nulla.
if ( vtAx.z * ( ptE - ptS).z < EPS_ZERO)
return true ;
// Raggi di sicurezza per evitare di tagliare i dexel a filo del bordo dela regione interessata dal taglio.
double dSqSafeMinRad = dMinRad * dMinRad + 2 * dMinRad * EPS_SMALL ;
double dSqSafeMaxRad = dMaxRad * dMaxRad - 2 * dMaxRad * EPS_SMALL ;
Point3d ptSXY( ptS.x, ptS.y, 0) ;
// Ciclo sui dexel.
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) ;
Vector3d vtR = ptC - ptSXY ;
double dSqLenR = vtR * vtR ;
if ( dSqLenR > dSqSafeMinRad && dSqLenR < dSqSafeMaxRad) {
double dMinZ = min( ptS.z, ptE.z) ;
double dMaxZ = max( ptS.z, ptE.z) ;
Vector3d vtMinN, vtMaxN ;
if ( ptE.z < ptS.z) {
vtMinN.z = 1 ;
vtMaxN;
}
else {
vtMinN;
vtMaxN.z = - 1 ;
}
}
}
}
return true ;
}
// Cilindro
//----------------------------------------------------------------------------
@@ -5345,8 +5389,8 @@ VolZmap::SurfConus_ZDrilling( int nGrid, const Point3d& ptS, const Point3d& ptE,
double dDeltaH = dMinRad * dHei / ( dMaxRad - dMinRad) ;
Point3d ptVertE = ptE - ( dHei + dDeltaH) * vtToolDir ;
Point3d ptIntMinP( dX, dY, dMinZ) ;
Vector3d vtIntMinV = ptIntMin - ptVertE ;
double dCompLong = vtIntMin * vtToolDir ;
Vector3d vtIntMinV = ptIntMinP - ptVertE ;
double dCompLong = vtIntMinV * vtToolDir ;
Vector3d vtIntMinLongV = dCompLong * vtToolDir ;
Vector3d vtIntMinOrtV = vtIntMinV - vtIntMinLongV ;
vtMinN = - vtIntMinOrtV + dCompLong * vtToolDir ;
@@ -5355,8 +5399,8 @@ VolZmap::SurfConus_ZDrilling( int nGrid, const Point3d& ptS, const Point3d& ptE,
double dDeltaH = dMinRad * dHei / ( dMaxRad - dMinRad) ;
Point3d ptVertE = ptE - ( dHei + dDeltaH) * vtToolDir ;
Point3d ptIntMaxP( dX, dY, dMaxZ) ;
Vector3d vtIntMaxV = ptIntMax - ptVertE ;
double dCompLong = vtIntMax * vtToolDir ;
Vector3d vtIntMaxV = ptIntMaxP - ptVertE ;
double dCompLong = vtIntMaxV * vtToolDir ;
Vector3d vtIntMaxLongV = dCompLong * vtToolDir ;
Vector3d vtIntMaxOrtV = vtIntMaxV - vtIntMaxLongV ;
vtMaxN = vtIntMaxOrtV - dCompLong * vtToolDir ;
@@ -5373,8 +5417,8 @@ VolZmap::SurfConus_ZDrilling( int nGrid, const Point3d& ptS, const Point3d& ptE,
double dDeltaH = dMinRad * dHei / ( dMaxRad - dMinRad) ;
Point3d ptVertE = ptE - ( dHei + dDeltaH) * vtToolDir ;
Point3d ptIntMaxP( dX, dY, dMaxZ) ;
Vector3d vtIntMaxV = ptIntMax - ptVertE ;
double dCompLong = vtIntMax * vtToolDir ;
Vector3d vtIntMaxV = ptIntMaxP - ptVertE ;
double dCompLong = vtIntMaxV * vtToolDir ;
Vector3d vtIntMaxLongV = dCompLong * vtToolDir ;
Vector3d vtIntMaxOrtV = vtIntMaxV - vtIntMaxLongV ;
vtMaxN = - vtIntMaxOrtV + dCompLong * vtToolDir ;
@@ -5383,8 +5427,8 @@ VolZmap::SurfConus_ZDrilling( int nGrid, const Point3d& ptS, const Point3d& ptE,
double dDeltaH = dMinRad * dHei / ( dMaxRad - dMinRad) ;
Point3d ptVertE = ptE - ( dHei + dDeltaH) * vtToolDir ;
Point3d ptIntMinP( dX, dY, dMinZ) ;
Vector3d vtIntMinV = ptIntMin - ptVertE ;
double dCompLong = vtIntMin * vtToolDir ;
Vector3d vtIntMinV = ptIntMinP - ptVertE ;
double dCompLong = vtIntMinV * vtToolDir ;
Vector3d vtIntMinLongV = dCompLong * vtToolDir ;
Vector3d vtIntMinOrtV = vtIntMinV - vtIntMinLongV ;
vtMinN = vtIntMinOrtV - dCompLong * vtToolDir ;
@@ -5409,8 +5453,9 @@ VolZmap::SurfConus_Drilling( int nGrid, const Point3d& ptS, const Point3d& ptE,
// Vettore spostamento
Vector3d vtDisp = ptE - ptS ;
if ( ( vtToolDir * vtDisp > 0 && bOuterCutter) ||
( vtToolDir * vtDisp < 0 && ! bOuterCutter))
bool bToolVecAndDispAreOpposite = vtToolDir * vtDisp < 0 ;
if ( ( ! bToolVecAndDispAreOpposite && bOuterCutter) ||
( bToolVecAndDispAreOpposite && ! bOuterCutter))
return true ;
// Vertici cono iniziale e finale
@@ -5436,7 +5481,7 @@ VolZmap::SurfConus_Drilling( int nGrid, const Point3d& ptS, const Point3d& ptE,
Vector3d vtN1, vtN2 ;
// Intersezione con il cono in posizione iniziale
int nIntNum = IntersLineConeCuttedByPlanes( ptC, Z_AX, ptS, vtToolDir, dMaxRad, dHei, true,
int nIntNum = IntersLineConeCuttedByPlanes( ptC, Z_AX, ptS - dHei * vtToolDir, vtToolDir, dMaxRad, dHei, true,
vCutConePlaneVecSt, ptInt1, vtN1, ptInt2, vtN2);
if ( nIntNum >= 1) {
vParAndNormIntersVec.emplace_back() ;
@@ -5450,7 +5495,7 @@ VolZmap::SurfConus_Drilling( int nGrid, const Point3d& ptS, const Point3d& ptE,
}
// Intersezione con il cono in posizione finale
nIntNum = IntersLineConeCuttedByPlanes( ptC, Z_AX, ptE, vtToolDir, dMaxRad, dHei, true,
nIntNum = IntersLineConeCuttedByPlanes( ptC, Z_AX, ptE - dHei * vtToolDir, vtToolDir, dMaxRad, dHei, true,
vCutConePlaneVecEn, ptInt1, vtN1, ptInt2, vtN2) ;
if ( nIntNum >= 1) {
vParAndNormIntersVec.emplace_back() ;
@@ -5464,7 +5509,7 @@ VolZmap::SurfConus_Drilling( int nGrid, const Point3d& ptS, const Point3d& ptE,
}
// Intersezione con il cilindro esterno
nIntNum = IntersLineCylinderCuttedByPlanes( ptC, Z_AX, ptS, vtDisp * vtAx, dMaxRad, dHei, true,
nIntNum = IntersLineCylinderCuttedByPlanes( ptC, Z_AX, ptS, vtToolDir, dMaxRad, ( bToolVecAndDispAreOpposite ? - 1 : 1) * dHei, true,
vEmptyPlaneVec, ptInt1, vtN1, ptInt2, vtN2) ;
if ( nIntNum >= 1) {
vParAndNormIntersVec.emplace_back() ;
@@ -5478,7 +5523,7 @@ VolZmap::SurfConus_Drilling( int nGrid, const Point3d& ptS, const Point3d& ptE,
}
// Intersezione con il cilindro interno
nIntNum = IntersLineCylinderCuttedByPlanes( ptC, Z_AX, ptS - dHei * vtToolDir, vtToolDir, dMinRad, dHei, true,
nIntNum = IntersLineCylinderCuttedByPlanes( ptC, Z_AX, ptS/* - dHei * vtToolDir*/, vtToolDir, dMinRad, ( bToolVecAndDispAreOpposite ? - 1 : 1) * dHei, true,
vEmptyPlaneVec, ptInt1, vtN1, ptInt2, vtN2) ;
if ( nIntNum >= 1) {
vParAndNormIntersVec.emplace_back() ;