PAD::TransformShapeWithClearanceToPolygon(): better polygonal shapes:

- Oval and round pads ensure at least 16 segments per CIRCLE (like other shapes)
- For ERROR_OUTSIDE option, ensure the aarc approx error is the actual error,
not max allowed error.
These changes can be seen only for a large max allowed approx error, especially
when filling zones.
This commit is contained in:
jean-pierre charras 2021-07-06 10:50:46 +02:00
parent 5116fa6d12
commit 1a23502e98
1 changed files with 11 additions and 4 deletions

View File

@ -607,7 +607,7 @@ void PAD::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
if( dx == dy || ( GetShape() == PAD_SHAPE::CIRCLE ) )
{
TransformCircleToPolygon( aCornerBuffer, padShapePos, dx + aClearanceValue, aError,
aErrorLoc );
aErrorLoc, pad_min_seg_per_circle_count );
}
else
{
@ -617,7 +617,8 @@ void PAD::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
RotatePoint( &delta, angle );
TransformOvalToPolygon( aCornerBuffer, padShapePos - delta, padShapePos + delta,
( half_width + aClearanceValue ) * 2, aError, aErrorLoc );
( half_width + aClearanceValue ) * 2, aError, aErrorLoc,
pad_min_seg_per_circle_count );
}
break;
@ -651,7 +652,10 @@ void PAD::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
int clearance = aClearanceValue;
if( aErrorLoc == ERROR_OUTSIDE )
clearance += GetCircleToPolyCorrection( aError );
{
int actual_error = CircleToEndSegmentDeltaRadius( clearance, numSegs );
clearance += GetCircleToPolyCorrection( actual_error );
}
outline.Inflate( clearance, numSegs );
}
@ -726,7 +730,10 @@ void PAD::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
int clearance = aClearanceValue;
if( aErrorLoc == ERROR_OUTSIDE )
clearance += GetCircleToPolyCorrection( aError );
{
int actual_error = CircleToEndSegmentDeltaRadius( clearance, numSegs );
clearance += GetCircleToPolyCorrection( actual_error );
}
outline.Inflate( clearance, numSegs );
outline.Simplify( SHAPE_POLY_SET::PM_FAST );