Respect ERROR_OUTSIDE when inflating polygons.

Fixes https://gitlab.com/kicad/code/kicad/issues/10896
This commit is contained in:
Jeff Young 2022-02-21 15:19:20 +00:00
parent 79c7859052
commit e6c617b74d
4 changed files with 16 additions and 3 deletions

View File

@ -928,10 +928,12 @@ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask,
continue;
// add shapes inflated by aMinThickness/2 in areas
zone->TransformSmoothedOutlineToPolygon( areas, inflate + zone_margin, boardOutline );
zone->TransformSmoothedOutlineToPolygon( areas, inflate + zone_margin, maxError,
ERROR_OUTSIDE, boardOutline );
// add shapes with their exact mask layer size in initialPolys
zone->TransformSmoothedOutlineToPolygon( initialPolys, zone_margin, boardOutline );
zone->TransformSmoothedOutlineToPolygon( initialPolys, zone_margin, maxError,
ERROR_OUTSIDE, boardOutline );
}
}

View File

@ -1174,6 +1174,7 @@ double ZONE::CalculateOutlineArea()
void ZONE::TransformSmoothedOutlineToPolygon( SHAPE_POLY_SET& aCornerBuffer, int aClearance,
int aMaxError, ERROR_LOC aErrorLoc,
SHAPE_POLY_SET* aBoardOutline ) const
{
// Creates the zone outline polygon (with holes if any)
@ -1193,6 +1194,10 @@ void ZONE::TransformSmoothedOutlineToPolygon( SHAPE_POLY_SET& aCornerBuffer, int
maxError = board->GetDesignSettings().m_MaxError;
int segCount = GetArcToSegmentCount( aClearance, maxError, FULL_CIRCLE );
if( aErrorLoc == ERROR_OUTSIDE )
aClearance += aMaxError;
polybuffer.Inflate( aClearance, segCount );
}
@ -1300,6 +1305,10 @@ void ZONE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
if( aClearance )
{
int numSegs = GetArcToSegmentCount( aClearance, aError, FULL_CIRCLE );
if( aErrorLoc == ERROR_OUTSIDE )
aClearance += aError;
aCornerBuffer.InflateWithLinkedHoles( aClearance, numSegs, SHAPE_POLY_SET::PM_FAST );
}
}

View File

@ -404,6 +404,7 @@ public:
* @param aBoardOutline is the board outline (if a valid one exists; nullptr otherwise)
*/
void TransformSmoothedOutlineToPolygon( SHAPE_POLY_SET& aCornerBuffer, int aClearance,
int aError, ERROR_LOC aErrorLoc,
SHAPE_POLY_SET* aBoardOutline ) const;
/**

View File

@ -851,7 +851,8 @@ void ZONE_FILLER::buildCopperItemClearances( const ZONE* aZone, PCB_LAYER_ID aLa
if( aKnockout->GetIsRuleArea() )
{
// Keepouts use outline with no clearance
aKnockout->TransformSmoothedOutlineToPolygon( aHoles, 0, nullptr );
aKnockout->TransformSmoothedOutlineToPolygon( aHoles, 0, m_maxError,
ERROR_OUTSIDE, nullptr );
}
else
{