Browse Source

Optimize zone-zone checks in filler

Teardrops are calculated as zones, so when we create a board with
thousands of teardrops, we don't want to run O(n^2) checks on the
clearance between multiple teardrops.  Instead, we can check only the
clearance where the two zones have the potential to interact

Fixes https://gitlab.com/kicad/code/kicad/-/issues/21226
pull/18/head
Seth Hillbrand 5 months ago
parent
commit
b165240118
  1. 8
      pcbnew/zone_filler.cpp

8
pcbnew/zone_filler.cpp

@ -1563,6 +1563,10 @@ void ZONE_FILLER::buildCopperItemClearances( const ZONE* aZone, PCB_LAYER_ID aLa
if( checkForCancel( m_progressReporter ) )
return;
// Only check zones whose bounding box overlaps the max clearance
if( !otherZone->GetBoundingBox().Intersects( zone_boundingbox ) )
continue;
// Negative clearance permits zones to short
if( evalRulesForItems( CLEARANCE_CONSTRAINT, aZone, otherZone, aLayer ) < 0 )
continue;
@ -1586,6 +1590,10 @@ void ZONE_FILLER::buildCopperItemClearances( const ZONE* aZone, PCB_LAYER_ID aLa
if( checkForCancel( m_progressReporter ) )
return;
// Only check zones whose bounding box overlaps
if( !otherZone->GetBoundingBox().Intersects( zone_boundingbox ) )
continue;
if( otherZone->GetIsRuleArea() )
{
if( otherZone->GetDoNotAllowZoneFills() && !aZone->IsTeardropArea() )

Loading…
Cancel
Save