Don't use bounding box cache during insideArea.

For starters we can't rely on it having been updated, but we also
cache the entire result so there's no huge cost-savings anyway.

Fixes https://gitlab.com/kicad/code/kicad/issues/10821

(cherry picked from commit 8dcc933fc3)
This commit is contained in:
Jeff Young 2022-02-12 13:35:30 +00:00
parent f8ac6df0cd
commit 7cba8e847d
2 changed files with 4 additions and 7 deletions

View File

@ -451,12 +451,12 @@ bool calcIsInsideArea( BOARD_ITEM* aItem, const EDA_RECT& aItemBBox, PCB_EXPR_CO
BOARD* board = aArea->GetBoard(); BOARD* board = aArea->GetBoard();
std::shared_ptr<SHAPE> shape; std::shared_ptr<SHAPE> shape;
if( !aArea->GetCachedBoundingBox().Intersects( aItemBBox ) ) if( !aArea->GetBoundingBox().Intersects( aItemBBox ) )
return false; return false;
// Collisions include touching, so we need to deflate outline by enough to // Collisions include touching, so we need to deflate outline by enough to exclude it.
// exclude touching. This is particularly important for detecting copper fills // This is particularly important for detecting copper fills as they will be exactly
// as they will be exactly touching along the entire border. // touching along the entire exclusion border.
SHAPE_POLY_SET areaOutline = *aArea->Outline(); SHAPE_POLY_SET areaOutline = *aArea->Outline();
areaOutline.Deflate( board->GetDesignSettings().GetDRCEpsilon(), 0, areaOutline.Deflate( board->GetDesignSettings().GetDRCEpsilon(), 0,
SHAPE_POLY_SET::ALLOW_ACUTE_CORNERS ); SHAPE_POLY_SET::ALLOW_ACUTE_CORNERS );

View File

@ -1035,9 +1035,6 @@ bool PNS_KICAD_IFACE_BASE::syncZone( PNS::NODE* aWorld, ZONE* aZone, SHAPE_POLY_
if( !aZone->GetIsRuleArea() && aZone->GetZoneName().IsEmpty() ) if( !aZone->GetIsRuleArea() && aZone->GetZoneName().IsEmpty() )
return false; return false;
// Required by expression function insideArea()
aZone->CacheBoundingBox();
// TODO handle aZone->GetDoNotAllowVias() // TODO handle aZone->GetDoNotAllowVias()
// TODO handle rules which disallow tracks & vias // TODO handle rules which disallow tracks & vias
if( !aZone->GetIsRuleArea() || !aZone->GetDoNotAllowTracks() ) if( !aZone->GetIsRuleArea() || !aZone->GetDoNotAllowTracks() )