Respect ERROR_OUTSIDE when inflating polygons.

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

(cherry picked from commit e6c617b74d)
This commit is contained in:
Jeff Young 2022-02-21 15:19:20 +00:00
parent b2ac4b2c65
commit 2498655cc5
4 changed files with 24 additions and 7 deletions

View File

@ -925,10 +925,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

@ -1266,6 +1266,7 @@ double ZONE::CalculateFilledArea()
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)
@ -1283,6 +1284,10 @@ void ZONE::TransformSmoothedOutlineToPolygon( SHAPE_POLY_SET& aCornerBuffer, int
maxError = board->GetDesignSettings().m_MaxError;
int segCount = GetArcToSegmentCount( aClearance, maxError, 360.0 );
if( aErrorLoc == ERROR_OUTSIDE )
aClearance += aMaxError;
polybuffer.Inflate( aClearance, segCount );
}
@ -1386,9 +1391,16 @@ void ZONE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
aCornerBuffer = m_FilledPolysList.at( aLayer );
int numSegs = GetArcToSegmentCount( aClearance, aError, 360.0 );
aCornerBuffer.Inflate( aClearance, numSegs );
aCornerBuffer.Simplify( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
// Rebuild filled areas only if clearance is not 0
if( aClearance )
{
int numSegs = GetArcToSegmentCount( aClearance, aError, 360.0 );
if( aErrorLoc == ERROR_OUTSIDE )
aClearance += aError;
aCornerBuffer.InflateWithLinkedHoles( aClearance, numSegs, SHAPE_POLY_SET::PM_FAST );
}
}

View File

@ -393,6 +393,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

@ -915,7 +915,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 if( bds.m_ZoneFillVersion == 5 )
{
@ -923,7 +924,8 @@ void ZONE_FILLER::buildCopperItemClearances( const ZONE* aZone, PCB_LAYER_ID aLa
int gap = evalRulesForItems( CLEARANCE_CONSTRAINT, aZone, aKnockout,
aLayer );
aKnockout->TransformSmoothedOutlineToPolygon( aHoles, gap, nullptr );
aKnockout->TransformSmoothedOutlineToPolygon( aHoles, gap, m_maxError,
ERROR_OUTSIDE, nullptr );
}
else
{