From e699bcf5a3384d94e6e04c51f2bb64d3f471b733 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Wed, 22 Feb 2023 16:21:28 -0800 Subject: [PATCH] Use Chamfer lines when deflating MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rounded line ends when deflating leads to microscopic jags in the outline that are not visible but add substantial computation time and minor error when computing polygon offsets. Instead, the chamfer deflate method prevents these jagged lines by clipping angles < 90° by the error level. This does not impact deflate calls where we explicitly require the angles to be maintained (cherry picked from commit af10878954608509ce696f425767ddca3ca36c05) --- libs/kimath/include/geometry/shape_poly_set.h | 2 +- pcbnew/zone_filler.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/kimath/include/geometry/shape_poly_set.h b/libs/kimath/include/geometry/shape_poly_set.h index 962be5fb91..4ec8d82de8 100644 --- a/libs/kimath/include/geometry/shape_poly_set.h +++ b/libs/kimath/include/geometry/shape_poly_set.h @@ -1012,7 +1012,7 @@ public: CORNER_STRATEGY aCornerStrategy = ROUND_ALL_CORNERS ); void Deflate( int aAmount, int aCircleSegmentsCount, - CORNER_STRATEGY aCornerStrategy = ROUND_ALL_CORNERS ) + CORNER_STRATEGY aCornerStrategy = CHAMFER_ALL_CORNERS ) { Inflate( -aAmount, aCircleSegmentsCount, aCornerStrategy ); } diff --git a/pcbnew/zone_filler.cpp b/pcbnew/zone_filler.cpp index 5f81740fa6..b596ab5594 100644 --- a/pcbnew/zone_filler.cpp +++ b/pcbnew/zone_filler.cpp @@ -1528,7 +1528,7 @@ bool ZONE_FILLER::fillCopperZone( const ZONE* aZone, PCB_LAYER_ID aLayer, PCB_LA */ if( half_min_width - epsilon > epsilon ) - aFillPolys.Deflate( half_min_width - epsilon, numSegs, cornerStrategy ); + aFillPolys.Deflate( half_min_width - epsilon, numSegs, fastCornerStrategy ); // Min-thickness is the web thickness. On the other hand, a blob min-thickness by // min-thickness is not useful. Since there's no obvious definition of web vs. blob, we