From 0070a4686ed79c300b7995d8130046b92a59a6b6 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sun, 13 Mar 2022 13:40:12 +0000 Subject: [PATCH] Cherry-pick the short-arc-is-really-a-segment fix from master. Fixes https://gitlab.com/kicad/code/kicad/issues/11119 --- libs/kimath/src/convert_basic_shapes_to_polygon.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/libs/kimath/src/convert_basic_shapes_to_polygon.cpp b/libs/kimath/src/convert_basic_shapes_to_polygon.cpp index d3cf277620..9ef89f6509 100644 --- a/libs/kimath/src/convert_basic_shapes_to_polygon.cpp +++ b/libs/kimath/src/convert_basic_shapes_to_polygon.cpp @@ -536,6 +536,17 @@ void TransformArcToPolygon( SHAPE_POLY_SET& aCornerBuffer, const wxPoint& aStart const wxPoint& aMid, const wxPoint& aEnd, int aWidth, int aError, ERROR_LOC aErrorLoc ) { + SEG startToEnd( aStart, aEnd ); + int distanceToMid = startToEnd.Distance( aMid ); + + if( distanceToMid <= 1 ) + { + // Not an arc but essentially a straight line with a small error + TransformOvalToPolygon( aCornerBuffer, aStart, aEnd, aWidth + distanceToMid, aError, + aErrorLoc ); + return; + } + SHAPE_ARC arc( aStart, aMid, aEnd, aWidth ); // Currentlye have currently 2 algos: // the first approximates the thick arc from its outlines