Handle fully-nested zones

The logic to handle divots needs to account for fully nested, same net
zones.  The process of subtracting led to us considering the inner zone
to be a zone knock-out (negative polygon).  To avoid this, we need to
check if the inner, higher priority zone has any connection to the outer
zone.  If it does not, then we can treat it as an isolated zone without
worrying about divots to the outer zone.
This commit is contained in:
Seth Hillbrand 2023-03-08 02:02:47 +01:00
parent 74a9d79a8d
commit 9146e38af4
1 changed files with 13 additions and 2 deletions

View File

@ -1163,6 +1163,9 @@ bool ZONE::BuildSmoothedPoly( SHAPE_POLY_SET& aSmoothedPoly, PCB_LAYER_ID aLayer
BOX2I sameNetBoundingBox = sameNetZone->GetBoundingBox();
SHAPE_POLY_SET sameNetPoly = sameNetZone->Outline()->CloneDropTriangulation();
SHAPE_POLY_SET diffNetPoly;
SHAPE_POLY_SET sumPoly = Outline()->CloneDropTriangulation();
sameNetPoly.ClearArcs();
// Of course there's always a wrinkle. The same-net intersecting zone *might* get knocked
@ -1172,11 +1175,19 @@ bool ZONE::BuildSmoothedPoly( SHAPE_POLY_SET& aSmoothedPoly, PCB_LAYER_ID aLayer
if( otherNetZone->HigherPriority( sameNetZone )
&& otherNetZone->GetBoundingBox().Intersects( sameNetBoundingBox ) )
{
sameNetPoly.BooleanSubtract( *otherNetZone->Outline(), SHAPE_POLY_SET::PM_FAST );
diffNetPoly.BooleanAdd( *otherNetZone->Outline(), SHAPE_POLY_SET::PM_FAST );
}
}
aSmoothedPoly.BooleanAdd( sameNetPoly, SHAPE_POLY_SET::PM_FAST );
// Second wrinkle. After unioning the higher priority, different net zones together,
// we need to check to see if they completely enclose our zone. If they do, then
// we need to treat the enclosed zone as isolated, not connected to the outer zone
// #13915
if( diffNetPoly.OutlineCount() )
sumPoly.BooleanSubtract( diffNetPoly, SHAPE_POLY_SET::PM_FAST );
if( sumPoly.OutlineCount() )
aSmoothedPoly.BooleanAdd( sameNetPoly, SHAPE_POLY_SET::PM_FAST );
}
if( aBoardOutline )