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
This commit is contained in:
Jeff Young 2022-02-12 13:35:30 +00:00
parent e742eea7ed
commit 8dcc933fc3
2 changed files with 4 additions and 7 deletions

View File

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

View File

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