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:
parent
65def26b4d
commit
761e754294
|
@ -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;
|
||||
}
|
||||
|
@ -1985,7 +1985,7 @@ bool LINE_PLACER::buildInitialLine( const VECTOR2I& aP, LINE& aHead, bool aForce
|
|||
|
||||
aHead.AppendVia( v );
|
||||
|
||||
PNS_DBG( Dbg(), AddPoint, v.Pos(), GREEN, 1000000, "via-force-coll-2" );
|
||||
PNS_DBG( Dbg(), AddPoint, v.Pos(), GREEN, 1000000, "via-force-coll-2" );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -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 )
|
||||
{
|
||||
|
@ -130,7 +130,7 @@ DIRECTION_45 MOUSE_TRAIL_TRACER::GetPosture( const VECTOR2I& aP )
|
|||
|
||||
double areaDiag = diag.Area();
|
||||
double ratio = areaS / ( areaDiag + 1.0 );
|
||||
|
||||
|
||||
// heuristic to detect that the user dragged back the cursor to the beginning of the trace
|
||||
// in this case, we cancel any forced posture and restart the trail
|
||||
if( m_forced && refLength < unlockDistanceFactor * m_tolerance )
|
||||
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue