From 5eb2a33498b8cb5fd20478357ff5f63e15cf5525 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Sun, 31 Mar 2019 22:12:51 -0700 Subject: [PATCH] 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 --- pcbnew/convert_drawsegment_list_to_polygon.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pcbnew/convert_drawsegment_list_to_polygon.cpp b/pcbnew/convert_drawsegment_list_to_polygon.cpp index 8bff699c00..9db9c717e7 100644 --- a/pcbnew/convert_drawsegment_list_to_polygon.cpp +++ b/pcbnew/convert_drawsegment_list_to_polygon.cpp @@ -324,7 +324,7 @@ bool ConvertOutlineToPolygon( std::vector& aSegList, SHAPE_POLY_SE // Output the Edge.Cuts perimeter as circle or polygon. if( graphic->GetShape() == S_CIRCLE ) { - int steps = GetArcToSegmentCount( graphic->GetRadius(), aTolerance, 360.0 ); + int steps = std::max( 4, GetArcToSegmentCount( graphic->GetRadius(), aTolerance, 360.0 ) ); TransformCircleToPolygon( aPolygons, graphic->GetCenter(), graphic->GetRadius(), steps ); } else if( graphic->GetShape() == S_POLYGON ) @@ -530,7 +530,7 @@ bool ConvertOutlineToPolygon( std::vector& aSegList, SHAPE_POLY_SE double angle = 3600.0; wxPoint start = center; int radius = graphic->GetRadius(); - int steps = GetArcToSegmentCount( radius, aTolerance, 360.0 ); + int steps = std::max( 4, GetArcToSegmentCount( radius, aTolerance, 360.0 ) ); wxPoint nextPt; start.x += radius;