Modifiche ad asportazioni avanzate

This commit is contained in:
LorenzoM
2021-07-22 12:52:30 +02:00
parent 6b6b30437f
commit a2325a266f
2 changed files with 84 additions and 36 deletions
+82 -34
View File
@@ -5308,7 +5308,7 @@ VolZmap::SurfCyl_Milling( int nGrid, const Point3d& ptS, const Point3d& ptE,
//----------------------------------------------------------------------------
bool
VolZmap::SurfConus_ZDrilling( int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir, double dHei, double dMaxRad, double dMinRad,
const Vector3d& vtArcNormMaxR, const Vector3d& vtArcNormMinR)
bool bOuterCutter, const Vector3d& vtArcNormMaxR, const Vector3d& vtArcNormMinR)
{
// Verifica sull'interferenza con lo Zmap
int nStartI, nStartJ, nEndI, nEndJ ;
@@ -5319,43 +5319,87 @@ VolZmap::SurfConus_ZDrilling( int nGrid, const Point3d& ptS, const Point3d& ptE,
double dSqSafeMinRad = dMinRad * dMinRad + 2 * dMinRad * EPS_SMALL ;
double dSqSafeMaxRad = dMaxRad * dMaxRad - 2 * dMaxRad * EPS_SMALL ;
//// Ciclo sui punti
//for ( int i = nStartI ; i <= nEndI ; ++ i) {
// for ( int j = nStartJ ; j <= nEndJ ; ++ j) {
//
// double dX = ( i + 0.5) * m_dStep - ptS.x ;
// double dY = ( j + 0.5) * m_dStep - ptS.y ;
// double dR = dX * dX + dY * dY ;
//
// if ( dR < dSqSafeMinRad || dR > dSqSafeMaxRad)
// continue ;
//
// if ( vtToolDir.z > 0) {
// double dr = sqrt( dR) ;
// // Quote Z
// double dMinZ = min( ptS.z, ptE.z) - dHei + ( dr - dMinRad) * dHei / ( dMaxRad - dMinRad) ;
// double dMaxZ = max( ptS.z, ptE.z) - dHei + ( dr - dMinRad) * dHei / ( dMaxRad - dMinRad) ;
// // Normali
// // distinguere vtMove * vtToolDir < 0 e vtMove * vtToolDir > 0
// }
// else {
// double dr = sqrt( dR) ;
// // Quote Z
// double dMinZ = min( ptS.z, ptE.z) + dHei - ( dr - dMinRad) * dHei / ( dMaxRad - dMinRad) ;
// double dMaxZ = max( ptS.z, ptE.z) + dHei - ( dr - dMinRad) * dHei / ( dMaxRad - dMinRad) ;
// // Normali
// // distinguere vtMove * vtToolDir < 0 e vtMove * vtToolDir > 0
// }
// }
//}
if ( ( vtToolDir.z * ( ptE.z - ptS.z) > 0 && bOuterCutter) ||
( vtToolDir.z * ( ptE.z - ptS.z) < 0 && ! bOuterCutter))
return true ;
// Ciclo sui punti
for ( int i = nStartI ; i <= nEndI ; ++ i) {
for ( int j = nStartJ ; j <= nEndJ ; ++ j) {
double dX = ( i + 0.5) * m_dStep - ptS.x ;
double dY = ( j + 0.5) * m_dStep - ptS.y ;
double dR = dX * dX + dY * dY ;
if ( dR < dSqSafeMinRad || dR > dSqSafeMaxRad)
continue ;
if ( vtToolDir.z > 0) {
double dr = sqrt( dR) ;
// Quote Z
double dMinZ = min( ptS.z, ptE.z) - dHei + ( dr - dMinRad) * dHei / ( dMaxRad - dMinRad) ;
double dMaxZ = max( ptS.z, ptE.z) - dHei + ( dr - dMinRad) * dHei / ( dMaxRad - dMinRad) ;
// Normali
Vector3d vtMinN, vtMaxN ;
if ( bOuterCutter) {
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 vtIntMinLongV = dCompLong * vtToolDir ;
Vector3d vtIntMinOrtV = vtIntMinV - vtIntMinLongV ;
vtMinN = - vtIntMinOrtV + dCompLong * vtToolDir ;
}
else {
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 vtIntMaxLongV = dCompLong * vtToolDir ;
Vector3d vtIntMaxOrtV = vtIntMaxV - vtIntMaxLongV ;
vtMaxN = vtIntMaxOrtV - dCompLong * vtToolDir ;
}
}
else {
double dr = sqrt( dR) ;
// Quote Z
double dMinZ = min( ptS.z, ptE.z) + dHei - ( dr - dMinRad) * dHei / ( dMaxRad - dMinRad) ;
double dMaxZ = max( ptS.z, ptE.z) + dHei - ( dr - dMinRad) * dHei / ( dMaxRad - dMinRad) ;
// Normali
Vector3d vtMinN, vtMaxN;
if ( bOuterCutter) {
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 vtIntMaxLongV = dCompLong * vtToolDir ;
Vector3d vtIntMaxOrtV = vtIntMaxV - vtIntMaxLongV ;
vtMaxN = - vtIntMaxOrtV + dCompLong * vtToolDir ;
}
else {
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 vtIntMinLongV = dCompLong * vtToolDir ;
Vector3d vtIntMinOrtV = vtIntMinV - vtIntMinLongV ;
vtMinN = vtIntMinOrtV - dCompLong * vtToolDir ;
}
}
}
}
return true ;
}
//----------------------------------------------------------------------------
/*bool
bool
VolZmap::SurfConus_Drilling( int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir,
double dHei, double dMaxRad, double dMinRad, bool bTapB, bool bTapT,
double dHei, double dMaxRad, double dMinRad, bool bOuterCutter, bool bTapB, bool bTapT,
const Vector3d& vtArcNormMaxR, const Vector3d& vtArcNormMinR)
{
int nStartI, nStartJ, nEndI, nEndJ ;
@@ -5365,6 +5409,10 @@ 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))
return true ;
// Vertici cono iniziale e finale
double dDeltaHei = ( dMinRad * dHei) / ( dMaxRad - dMinRad) ;
Point3d ptVs = ptS - ( dHei + dDeltaHei) * vtToolDir ;
@@ -5459,12 +5507,12 @@ VolZmap::SurfConus_Drilling( int nGrid, const Point3d& ptS, const Point3d& ptE,
}
return true ;
}*/
}
//----------------------------------------------------------------------------
/*bool
VolZmap::SurfConus_ZMilling( int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir, double dHei, double dMaxRad, double dMinRad,
const Vector3d& vtArcNormMaxR, const Vector3d& vtArcNormMinR)
bool bOuterCutter, const Vector3d& vtArcNormMaxR, const Vector3d& vtArcNormMinR)
{
int nStartI, nStartJ, nEndI, nEndJ ;
if ( ! TestCompoBBox( nGrid, ptS, ptE, vtToolDir, dMaxRad, dMinRad, dHei, nStartI, nStartJ, nEndI, nEndJ))