router: trying to improve the 'guess posture' algorithm to work well with both fix-all and fix-last-segment on click

This commit is contained in:
Tomasz Wlostowski 2023-01-12 23:35:41 +01:00
parent 65def26b4d
commit 761e754294
2 changed files with 7 additions and 5 deletions

View File

@ -1637,7 +1637,7 @@ bool LINE_PLACER::FixRoute( const VECTOR2I& aP, ITEM* aEndItem, bool aForceFinis
m_mouseTrailTracer.Clear();
m_mouseTrailTracer.SetTolerance( m_head.Width() );
m_mouseTrailTracer.AddTrailPoint( m_currentStart );
m_mouseTrailTracer.SetDefaultDirections( m_initial_direction, lastSegDir );
m_mouseTrailTracer.SetDefaultDirections( lastSegDir, DIRECTION_45::UNDEFINED );
m_placementCorrect = true;
}

View File

@ -92,10 +92,10 @@ DIRECTION_45 MOUSE_TRAIL_TRACER::GetPosture( const VECTOR2I& aP )
const double minAreaCutoffDistanceFactor = 6;
// Adjusts how far away from p0 we get before whatever posture we solved is locked in
const int lockDistanceFactor = 25;
const int lockDistanceFactor = 30;
// Adjusts how close to p0 we unlock the posture again if one was locked already
const int unlockDistanceFactor = 4;
const int unlockDistanceFactor = 10;
if( m_trail.PointCount() < 2 || m_manuallyForced )
{
@ -156,6 +156,8 @@ DIRECTION_45 MOUSE_TRAIL_TRACER::GetPosture( const VECTOR2I& aP )
areaOk = true;
}
PNS_DBG( dbg, Message, wxString::Format( "Posture: rl %.0f thr %d tol %d as %.3f area OK %d forced %d\n", refLength, (int)(unlockDistanceFactor * m_tolerance), m_tolerance, ratio, areaOk?1:0, m_forced?1:0 ) );
DIRECTION_45 straightDirection;
DIRECTION_45 diagDirection;
DIRECTION_45 newDirection = m_direction;