From f40f696c37dab2fa788615f30d15730f5e1f9632 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Wed, 2 Jun 2021 17:13:10 -0700 Subject: [PATCH] Don't extract dp segment info from minimal-length segments with 1IU of length are approximately parallel to everything and the distance projections break down into rounding errors Fixes https://gitlab.com/kicad/code/kicad/issues/8541 --- pcbnew/drc/drc_test_provider_diff_pair_coupling.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pcbnew/drc/drc_test_provider_diff_pair_coupling.cpp b/pcbnew/drc/drc_test_provider_diff_pair_coupling.cpp index 40a27a23f9..c7a21e00b7 100644 --- a/pcbnew/drc/drc_test_provider_diff_pair_coupling.cpp +++ b/pcbnew/drc/drc_test_provider_diff_pair_coupling.cpp @@ -209,7 +209,9 @@ static void extractDiffPairCoupledItems( DIFF_PAIR_ITEMS& aDp, DRC_RTREE& aTree SEG ssp ( sp->GetStart(), sp->GetEnd() ); SEG ssn ( sn->GetStart(), sn->GetEnd() ); - if( ssp.ApproxParallel(ssn) ) + // Segments that are == 1 IU in length are approximately parallel with everything and their + // parallel projection is < 1 IU, leading to bad distance calculations + if( ssp.SquaredLength() > 1 && ssn.SquaredLength() > 1 && ssp.ApproxParallel(ssn) ) { DIFF_PAIR_COUPLED_SEGMENTS cpair; bool coupled = commonParallelProjection( ssp, ssn, cpair.coupledP, cpair.coupledN );