From 0ec3726fc629cac04a021d01e3079aae4f07bfb4 Mon Sep 17 00:00:00 2001 From: DarioS Date: Fri, 15 Jul 2022 07:40:16 +0200 Subject: [PATCH] EgtMachKernel 2.4g3 : - altra correzione per asse rotante con corsa nulla. --- EgtMachKernel.rc | Bin 11774 -> 11774 bytes MachineCalc.cpp | 29 +++++++++++++++++++---------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index 5d5c08f52b47b69b2a4dbef8efe4cc57f08909d9..ea6fea0c444ee5198735a910d2abf98768217586 100644 GIT binary patch delta 97 zcmewt{V#gMFE&Qw&A-`fnHh~IKa|wnoW?bQ1uSxrY4Qod0+^@}R1`^_2jk{d(jGv4 NK<#LXK~l;gTmUD-Bai?9 delta 97 zcmewt{V#gMFE&P_&A-`fnHh~HKa|wnoW?bQ1uSxrY4Qod0+^@}R1`^_2jk{d(jGv4 NK<#LXK~l;gTmU8!BZvS1 diff --git a/MachineCalc.cpp b/MachineCalc.cpp index 36f0733..bf2867a 100644 --- a/MachineCalc.cpp +++ b/MachineCalc.cpp @@ -1418,14 +1418,26 @@ Machine::VerifyScc( const Vector3d& vtDirI, const Vector3d& vtDirA, int nSolCh, bool Machine::AdjustAngleInStroke( const STROKE& Stroke, double& dAng) const { - // eseguo gli aggiustamenti - while ( dAng < Stroke.Min) - dAng += ANG_FULL ; - while ( dAng > Stroke.Max) - dAng -= ANG_FULL ; - // se asse rotante a corsa nulla - if ( Stroke.Max - Stroke.Min < EPS_ANG_SMALL) { + // se asse rotante vero + if ( Stroke.Max - Stroke.Min > EPS_ANG_SMALL) { + // eseguo gli aggiustamenti + while ( dAng < Stroke.Min) + dAng += ANG_FULL ; + while ( dAng > Stroke.Max) + dAng -= ANG_FULL ; + // verifico + return ( dAng >= Stroke.Min && dAng <= Stroke.Max) ; + } + // altrimenti asse rotante senza corsa + else { + // angolo di riferimento double dStrokeMid = ( Stroke.Min + Stroke.Max) / 2 ; + // eseguo gli aggiustamenti + while ( dAng < dStrokeMid - EPS_ANG_SMALL) + dAng += ANG_FULL ; + while ( dAng > dStrokeMid + EPS_ANG_SMALL) + dAng -= ANG_FULL ; + // verifico if ( abs( dAng - dStrokeMid) < EPS_ANG_SMALL) { dAng = dStrokeMid ; return true ; @@ -1433,9 +1445,6 @@ Machine::AdjustAngleInStroke( const STROKE& Stroke, double& dAng) const else return false ; } - // altrimenti assi rotante vero - else - return ( dAng >= Stroke.Min && dAng <= Stroke.Max) ; } //----------------------------------------------------------------------------