Work around a round-off bug in Clipper.
Fixes https://gitlab.com/kicad/code/kicad/issues/6260
This commit is contained in:
parent
ae9afdd169
commit
55c25f3cc4
|
@ -604,6 +604,10 @@ void SHAPE_POLY_SET::Inflate( int aAmount, int aCircleSegmentsCount,
|
||||||
if( aCircleSegmentsCount < 6 ) // avoid incorrect aCircleSegmentsCount values
|
if( aCircleSegmentsCount < 6 ) // avoid incorrect aCircleSegmentsCount values
|
||||||
aCircleSegmentsCount = 6;
|
aCircleSegmentsCount = 6;
|
||||||
|
|
||||||
|
// Clipper has a bug where round-off error is accumulated into the last segment. Increasing
|
||||||
|
// the segment count by one probably accounts for this, but we increment by 2 to be safe.
|
||||||
|
aCircleSegmentsCount += 2;
|
||||||
|
|
||||||
double coeff;
|
double coeff;
|
||||||
|
|
||||||
if( aCircleSegmentsCount > SEG_CNT_MAX || arc_tolerance_factor[aCircleSegmentsCount] == 0 )
|
if( aCircleSegmentsCount > SEG_CNT_MAX || arc_tolerance_factor[aCircleSegmentsCount] == 0 )
|
||||||
|
|
|
@ -627,7 +627,11 @@ void D_PAD::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
|
||||||
{
|
{
|
||||||
int numSegs = std::max( GetArcToSegmentCount( aClearanceValue, aError, 360.0 ),
|
int numSegs = std::max( GetArcToSegmentCount( aClearanceValue, aError, 360.0 ),
|
||||||
pad_min_seg_per_circle_count );
|
pad_min_seg_per_circle_count );
|
||||||
int clearance = aClearanceValue + GetCircleToPolyCorrection( aError );
|
int clearance = aClearanceValue;
|
||||||
|
|
||||||
|
if( aErrorLoc == ERROR_OUTSIDE )
|
||||||
|
clearance += GetCircleToPolyCorrection( aError );
|
||||||
|
|
||||||
outline.Inflate( clearance, numSegs );
|
outline.Inflate( clearance, numSegs );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -753,6 +753,8 @@ void ZONE_FILLER::buildCopperItemClearances( const ZONE_CONTAINER* aZone, PCB_LA
|
||||||
else
|
else
|
||||||
gap = evalRulesForItems( CLEARANCE_CONSTRAINT, aZone, aPad, aLayer );
|
gap = evalRulesForItems( CLEARANCE_CONSTRAINT, aZone, aPad, aLayer );
|
||||||
|
|
||||||
|
gap += extra_margin;
|
||||||
|
|
||||||
addKnockout( aPad, aLayer, gap, aHoles );
|
addKnockout( aPad, aLayer, gap, aHoles );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue