Modifiche vm additivo

This commit is contained in:
LorenzoM
2022-01-10 18:27:41 +01:00
parent fd9a6a9847
commit 20a9efaebb
3 changed files with 49 additions and 26 deletions
+36 -23
View File
@@ -255,6 +255,10 @@ bool
VolZmap::AddIntervals( int nGrid, int nI, int nJ,
double dMin, double dMax, const Vector3d& vtNMin, const Vector3d& vtNMax)
{
// Restringo minimo e massimo entro i limiti della mappa
dMin = Clamp( dMin, m_dMinZ[nGrid], m_dMaxZ[nGrid]) ;
dMax = Clamp( dMax, m_dMinZ[nGrid], m_dMaxZ[nGrid]) ;
// Controllo che dMin e dMax non siano quasi coincidenti
if ( abs( dMax - dMin) < EPS_SMALL)
return true ;
@@ -309,11 +313,11 @@ VolZmap::AddIntervals( int nGrid, int nI, int nJ,
vDexel.back().vtMaxN = vtNma ;
vDexel.back().nToolMax = m_vTool[m_nCurrTool].GetCurrentToolNum() ;
if ( dMax > m_dMaxZ[nGrid])
/*if ( dMax > m_dMaxZ[nGrid])
m_dMaxZ[nGrid] = dMax ;
if ( dMin < m_dMinZ[nGrid])
m_dMinZ[nGrid] = dMin ;
m_dMinZ[nGrid] = dMin ;*/
m_OGrMgr.Reset() ;
@@ -726,22 +730,25 @@ VolZmap::MillingTranslationStep( const Point3d& ptPs, const Point3d& ptPe, const
Vector3d vtLs[N_MAPS] ;
Vector3d vtALs[N_MAPS] ;
InitializePointsAndVectors( ptPs, ptPe, vtD, vtA, ptLs, ptLe, vtLs, vtALs) ;
// Ciclo sulle mappe
vector< future<bool>> vRes ;
vRes.resize( m_nMapNum) ;
for ( int i = 0 ; i < m_nMapNum ; ++ i) {
vRes[i] = async( launch::async, &VolZmap::SelectMotion, this, i, cref( ptLs[i]), cref( ptLe[i]), cref( vtLs[i]), cref( vtALs[i])) ;
}
bool bOk = true ;
int nTerminated = 0 ;
while ( nTerminated < m_nMapNum) {
for ( int i = 0 ; i < m_nMapNum ; ++ i) {
if ( vRes[i].valid() && vRes[i].wait_for( chrono::nanoseconds{ 1}) == future_status::ready) {
bOk = vRes[i].get() && bOk ;
++ nTerminated ;
}
}
SelectMotion( i, ptLs[i], ptLe[i], vtLs[i], vtALs[i]) ;
}
// Ciclo sulle mappe
//vector< future<bool>> vRes ;
//vRes.resize( m_nMapNum) ;
//for ( int i = 0 ; i < m_nMapNum ; ++ i) {
// vRes[i] = async( launch::async, &VolZmap::SelectMotion, this, i, cref( ptLs[i]), cref( ptLe[i]), cref( vtLs[i]), cref( vtALs[i])) ;
//}
//bool bOk = true ;
//int nTerminated = 0 ;
//while ( nTerminated < m_nMapNum) {
// for ( int i = 0 ; i < m_nMapNum ; ++ i) {
// if ( vRes[i].valid() && vRes[i].wait_for( chrono::nanoseconds{ 1}) == future_status::ready) {
// bOk = vRes[i].get() && bOk ;
// ++ nTerminated ;
// }
// }
//}
return true ;
}
@@ -828,7 +835,7 @@ VolZmap::SelectMotion( int nGrid, const Point3d& ptLs, const Point3d& ptLe, cons
Chs_Milling( nGrid, ptLs, ptLe, vtL, vtAL) ;
break ;
case Tool::ADDITIVE :
// Chiama metodo
AddingMotion( nGrid, ptLs, ptLe, vtL) ;
break ;
}
}
@@ -906,7 +913,7 @@ VolZmap::SelectMotion( int nGrid, const Point3d& ptLs, const Point3d& ptLe, cons
Chs_Milling( nGrid, ptLs, ptLe, vtL, vtAL) ;
break ;
case Tool::ADDITIVE :
// Chiama metodo
AddingMotion( nGrid, ptLs, ptLe, vtL) ;
break ;
}
}
@@ -7806,13 +7813,14 @@ VolZmap::AddingMotion( int nGrid, const Point3d& ptS, const Point3d& ptE, const
Vector3d vtV1 = ptE - ptS ;
double dLen1 = vtV1.Len() ;
vtV1 / dLen1 ;
Vector3d vtV2 = Z_AX ^ vtV1 ;
vtV1 /= dLen1 ;
if ( dCornerRad < EPS_SMALL) {
if ( nGrid == 0) {
Vector3d vtV2 = Z_AX ^ vtV1 ;
for ( int i = nStartI ; i <= nEndI ; ++ i) {
for ( int j = nStartJ ; j <= nEndJ ; ++ j) {
@@ -7836,8 +7844,8 @@ VolZmap::AddingMotion( int nGrid, const Point3d& ptS, const Point3d& ptE, const
PolyFrame.Set( ptS - dHei * 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 - ptS.x, ( j + 0.5) * m_dStep - ptS.y, 0) ;
Point3d ptC( ( i + 0.5) * m_dStep, ( j + 0.5) * m_dStep, 0) ;
Point3d ptInt1, ptInt2 ;
Vector3d vtN1, vtN2 ;
@@ -7847,7 +7855,12 @@ VolZmap::AddingMotion( int nGrid, const Point3d& ptS, const Point3d& ptE, const
AddIntervals( nGrid, i, j, ptInt1.z, ptInt2.z, - vtN1, - vtN2) ;
}
if ( IntersLineMyPolyhedron( ptC - dLen1 * vtV1, Z_AX, PolyFrame, dLen1, dRad, dHei, 0,
if ( IntersLineCylinder( ptC - dLen1 * vtV1, Z_AX, CylFrame, dHei, dRad, true, true,
ptInt1, vtN1, ptInt2, vtN2)) {
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, dHei, 0,
ptInt1, vtN1, ptInt2, vtN2)) {
AddIntervals( nGrid, i, j, ptInt1.z, ptInt2.z, - vtN1, - vtN2) ;
}