Fix guaranteed divide-by-zero error when called with correction of 0.
This commit is contained in:
parent
715448611d
commit
2e509480a4
|
@ -646,15 +646,22 @@ void D_PAD::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
|
||||||
|
|
||||||
case PAD_SHAPE_CUSTOM:
|
case PAD_SHAPE_CUSTOM:
|
||||||
{
|
{
|
||||||
int numSegs = std::max( GetArcToSegmentCount( aClearanceValue, aError, 360.0 ),
|
|
||||||
pad_min_seg_per_circle_count );
|
|
||||||
double correction = GetCircletoPolyCorrectionFactor( numSegs );
|
|
||||||
int clearance = KiROUND( aClearanceValue * correction );
|
|
||||||
SHAPE_POLY_SET outline; // Will contain the corners in board coordinates
|
SHAPE_POLY_SET outline; // Will contain the corners in board coordinates
|
||||||
outline.Append( m_customShapeAsPolygon );
|
outline.Append( m_customShapeAsPolygon );
|
||||||
CustomShapeAsPolygonToBoardPosition( &outline, GetPosition(), GetOrientation() );
|
CustomShapeAsPolygonToBoardPosition( &outline, GetPosition(), GetOrientation() );
|
||||||
|
// TODO: do we need the Simplify() & Fracture() if we're not inflating?
|
||||||
outline.Simplify( SHAPE_POLY_SET::PM_FAST );
|
outline.Simplify( SHAPE_POLY_SET::PM_FAST );
|
||||||
outline.Inflate( clearance, numSegs );
|
|
||||||
|
if( aClearanceValue )
|
||||||
|
{
|
||||||
|
int numSegs = std::max( GetArcToSegmentCount( aClearanceValue, aError, 360.0 ),
|
||||||
|
pad_min_seg_per_circle_count );
|
||||||
|
double correction = GetCircletoPolyCorrectionFactor( numSegs );
|
||||||
|
int clearance = KiROUND( aClearanceValue * correction );
|
||||||
|
|
||||||
|
outline.Inflate( clearance, numSegs );
|
||||||
|
}
|
||||||
|
|
||||||
outline.Fracture( SHAPE_POLY_SET::PM_FAST );
|
outline.Fracture( SHAPE_POLY_SET::PM_FAST );
|
||||||
aCornerBuffer.Append( outline );
|
aCornerBuffer.Append( outline );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue