From 90bc5c19cf07284789eb567c6e7925dae28c17b2 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 16 Sep 2022 19:16:15 +0100 Subject: [PATCH] Performance enhancement for zone filling. --- pcbnew/zone.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pcbnew/zone.cpp b/pcbnew/zone.cpp index d3f57c596b..63c6efb430 100644 --- a/pcbnew/zone.cpp +++ b/pcbnew/zone.cpp @@ -986,7 +986,10 @@ bool ZONE::IsIsland( PCB_LAYER_ID aLayer, int aPolyIdx ) const void ZONE::GetInteractingZones( PCB_LAYER_ID aLayer, std::vector* aZones ) const { - int epsilon = Millimeter2iu( 0.001 ); + int epsilon = Millimeter2iu( 0.001 ); + BOX2I bbox = GetCachedBoundingBox(); + + bbox.Inflate( epsilon ); for( ZONE* candidate : GetBoard()->Zones() ) { @@ -1002,6 +1005,9 @@ void ZONE::GetInteractingZones( PCB_LAYER_ID aLayer, std::vector* aZones if( candidate->GetNetCode() != GetNetCode() ) continue; + if( !candidate->GetCachedBoundingBox().Intersects( bbox ) ) + continue; + for( auto iter = m_Poly->CIterate(); iter; iter++ ) { if( candidate->m_Poly->Collide( iter.Get(), epsilon ) )