EgtMachKernel :

- corretto calcolo angoli più vicini a quelli di lavorazione precedente.
This commit is contained in:
Dario Sassi
2016-07-06 16:05:38 +00:00
parent 6065c07c98
commit 44092243cf
4 changed files with 10 additions and 10 deletions
+6 -6
View File
@@ -1015,18 +1015,18 @@ Machine::AdjustAngleInStroke( const STROKE& Stroke, double& dAng) const
//----------------------------------------------------------------------------
bool
Machine::GetNearestAngleInStroke( int nId, double dAngRef, double& dAng) const
Machine::GetNearestAngleInStroke( int nInd, double dAngRef, double& dAng) const
{
// se angolo fittizio (non esiste l'asse rotante corrispondente), non c'è alcunchè da fare
if ( nId <= 0 || nId > int( m_vCalcRotAx.size()))
if ( nInd < 0 || nInd >= int( m_vCalcRotAx.size()))
return true ;
// cerco l'angolo più vicino stando nella corsa
while ( dAng - dAngRef > ANG_STRAIGHT && dAng - ANG_FULL >= m_vCalcRotAx[nId-1].stroke.Min)
while ( dAng - dAngRef > ANG_STRAIGHT && dAng - ANG_FULL >= m_vCalcRotAx[nInd].stroke.Min)
dAng -= ANG_FULL ;
while ( dAng - dAngRef < - ANG_STRAIGHT && dAng + ANG_FULL <= m_vCalcRotAx[nId-1].stroke.Max)
while ( dAng - dAngRef < - ANG_STRAIGHT && dAng + ANG_FULL <= m_vCalcRotAx[nInd].stroke.Max)
dAng += ANG_FULL ;
return ( dAng >= m_vCalcRotAx[nId-1].stroke.Min &&
dAng <= m_vCalcRotAx[nId-1].stroke.Max) ;
return ( dAng >= m_vCalcRotAx[nInd].stroke.Min &&
dAng <= m_vCalcRotAx[nInd].stroke.Max) ;
}
//----------------------------------------------------------------------------