From 9c8ae217a62eccf6af9ec83577b0d847b43f466a Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Fri, 25 Oct 2019 07:26:10 -0700 Subject: [PATCH] pcbnew: Treat circular ovals as circles The oval clearance adds an edge on the 0-length side of a circular oval. This is not needed and can affect the fill algorithm. Instead, we treat round ovals as circles for pad polygons Fixes: lp:1849846 * https://bugs.launchpad.net/kicad/+bug/1849846 (cherry picked from commit 57f0f885522ad87026cdd4e432f9a7c18464a341) --- ...board_items_to_polygon_shape_transform.cpp | 36 +++++++++++-------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/pcbnew/board_items_to_polygon_shape_transform.cpp b/pcbnew/board_items_to_polygon_shape_transform.cpp index faf7a39b9a..26082fc5fc 100644 --- a/pcbnew/board_items_to_polygon_shape_transform.cpp +++ b/pcbnew/board_items_to_polygon_shape_transform.cpp @@ -562,27 +562,33 @@ void D_PAD::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, break; case PAD_SHAPE_OVAL: - { - // An oval pad has the same shape as a segment with rounded ends - int width; - wxPoint shape_offset; - if( dy > dx ) // Oval pad X/Y ratio for choosing translation axis + // If the oval is actually a circle (same x/y size), treat it the same + if( dx == dy ) { - shape_offset.y = dy - dx; - width = dx * 2; + TransformCircleToPolygon( aCornerBuffer, padShapePos, dx, aError ); } - else //if( dy <= dx ) + else { - shape_offset.x = dy - dx; - width = dy * 2; + int width; + wxPoint shape_offset; + if( dy > dx ) // Oval pad X/Y ratio for choosing translation axis + { + shape_offset.y = dy - dx; + width = dx * 2; + } + else //if( dy <= dx ) + { + shape_offset.x = dy - dx; + width = dy * 2; + } + + RotatePoint( &shape_offset, angle ); + wxPoint start = padShapePos - shape_offset; + wxPoint end = padShapePos + shape_offset; + TransformOvalToPolygon( aCornerBuffer, start, end, width, aError ); } - RotatePoint( &shape_offset, angle ); - wxPoint start = padShapePos - shape_offset; - wxPoint end = padShapePos + shape_offset; - TransformOvalToPolygon( aCornerBuffer, start, end, width, aError ); - } break; case PAD_SHAPE_TRAPEZOID: