diff --git a/pcbnew/router/pns_diff_pair.cpp b/pcbnew/router/pns_diff_pair.cpp index e6e1019aa6..695ff0364e 100644 --- a/pcbnew/router/pns_diff_pair.cpp +++ b/pcbnew/router/pns_diff_pair.cpp @@ -403,7 +403,7 @@ void DP_GATEWAYS::FilterByOrientation ( int aAngleMask, DIRECTION_45 aRefOrienta m_gateways.erase( std::remove_if( m_gateways.begin(), m_gateways.end(), [aAngleMask, aRefOrientation]( const DP_GATEWAY& dp) { DIRECTION_45 orient( dp.AnchorP() - dp.AnchorN() ); - return !( orient.Angle( aRefOrientation ) & aAngleMask ); + return ( orient.Angle( aRefOrientation ) & aAngleMask ); } ), m_gateways.end() ); } diff --git a/pcbnew/router/pns_diff_pair_placer.cpp b/pcbnew/router/pns_diff_pair_placer.cpp index 8a33d333fb..022f36f927 100644 --- a/pcbnew/router/pns_diff_pair_placer.cpp +++ b/pcbnew/router/pns_diff_pair_placer.cpp @@ -661,14 +661,20 @@ bool DIFF_PAIR_PLACER::routeHead( const VECTOR2I& aP ) m_prevPair->CursorOrientation( fp, midp, dirV ); VECTOR2I fpProj = SEG( midp, midp + dirV ).LineProject( fp ); + + // compute 'leader point' distance from the cursor (project cursor position + // on the extension of the starting segment pair of the DP) int lead_dist = ( fpProj - fp ).EuclideanNorm(); gwsTarget.SetFitVias( m_placingVia, m_sizes.ViaDiameter(), viaGap() ); + // far from the initial segment extension line -> allow a 45-degree obtuse turn if( lead_dist > m_sizes.DiffPairGap() + m_sizes.DiffPairWidth() ) { gwsTarget.BuildForCursor( fp ); } + // close to the initial segment extension line -> keep straight part only, project as close + // as possible to the cursor else { gwsTarget.BuildForCursor( fpProj );