Fix success conditions in DP placer

The placer can sometimes generate segments that are not quite parallel.
Use a different tolerance for ApproxParallel to account for this.

Also set a minimum score for placement judging so that any placement
that doesn't violate DRC can be placed.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/9948
This commit is contained in:
Jon Evans 2021-12-12 13:05:26 -05:00
parent 885979ba75
commit b291d6c810
2 changed files with 2 additions and 2 deletions

View File

@ -837,7 +837,7 @@ void DIFF_PAIR::CoupledSegmentPairs( COUPLED_SEGMENTS_VEC& aPairs ) const
int64_t dist = std::abs( sp.Distance( sn ) - m_width );
if( sp.ApproxParallel( sn ) && m_gapConstraint.Matches( dist ) &&
if( sp.ApproxParallel( sn, 2 ) && m_gapConstraint.Matches( dist ) &&
commonParallelProjection( sp, sn, p_clip, n_clip ) )
{
const COUPLED_SEGMENTS spair( p_clip, sp, i, n_clip, sn, j );

View File

@ -278,7 +278,7 @@ bool DIFF_PAIR_PLACER::tryWalkDp( NODE* aNode, DIFF_PAIR &aPair, bool aSolidsOnl
if( attemptWalk( tmp, &aPair, p, pfirst, wind_cw, aSolidsOnly ) )
{
// double len = p.TotalLength();
double cl = p.CoupledLength();
double cl = 1 + p.CoupledLength();
double skew = p.Skew();
double score = cl + fabs( skew ) * 3.0;