pcbnew: Ensure DRC circles have at least 4 points

This prevents invalid outline errors for small circles.

Fixes: lp:1822641
* https://bugs.launchpad.net/kicad/+bug/1822641
This commit is contained in:
Seth Hillbrand 2019-03-31 22:12:51 -07:00
parent f20a1314ff
commit 5eb2a33498
1 changed files with 2 additions and 2 deletions

View File

@ -324,7 +324,7 @@ bool ConvertOutlineToPolygon( std::vector<DRAWSEGMENT*>& aSegList, SHAPE_POLY_SE
// Output the Edge.Cuts perimeter as circle or polygon. // Output the Edge.Cuts perimeter as circle or polygon.
if( graphic->GetShape() == S_CIRCLE ) if( graphic->GetShape() == S_CIRCLE )
{ {
int steps = GetArcToSegmentCount( graphic->GetRadius(), aTolerance, 360.0 ); int steps = std::max<int>( 4, GetArcToSegmentCount( graphic->GetRadius(), aTolerance, 360.0 ) );
TransformCircleToPolygon( aPolygons, graphic->GetCenter(), graphic->GetRadius(), steps ); TransformCircleToPolygon( aPolygons, graphic->GetCenter(), graphic->GetRadius(), steps );
} }
else if( graphic->GetShape() == S_POLYGON ) else if( graphic->GetShape() == S_POLYGON )
@ -530,7 +530,7 @@ bool ConvertOutlineToPolygon( std::vector<DRAWSEGMENT*>& aSegList, SHAPE_POLY_SE
double angle = 3600.0; double angle = 3600.0;
wxPoint start = center; wxPoint start = center;
int radius = graphic->GetRadius(); int radius = graphic->GetRadius();
int steps = GetArcToSegmentCount( radius, aTolerance, 360.0 ); int steps = std::max<int>( 4, GetArcToSegmentCount( radius, aTolerance, 360.0 ) );
wxPoint nextPt; wxPoint nextPt;
start.x += radius; start.x += radius;