From 54c3031d749e9fd04a6f0b2192b0462908fc9d07 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Fri, 19 Nov 2021 13:55:05 +0100 Subject: [PATCH] Zone fill: When using the fillet outline option, in some cases the shape is strange. Due to some bug in Fillet() incorrect zone outline happens in (rare) polygon shapes. So clip it with the initial polygon (aSmoothedPoly must be contained in m_Poly) Fixes #9692 https://gitlab.com/kicad/code/kicad/issues/9692 --- pcbnew/class_zone.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pcbnew/class_zone.cpp b/pcbnew/class_zone.cpp index df0206319d..9d0b949939 100644 --- a/pcbnew/class_zone.cpp +++ b/pcbnew/class_zone.cpp @@ -1307,6 +1307,11 @@ bool ZONE_CONTAINER::BuildSmoothedPoly( SHAPE_POLY_SET& aSmoothedPoly ) const aSmoothedPoly = m_Poly->Fillet( m_cornerRadius, ARC_HIGH_DEF ); else aSmoothedPoly = m_Poly->Fillet( m_cornerRadius, ARC_LOW_DEF ); + + // In some cases the resulting polygon is strange... due to some bug in Fillet() + // that happens in (rare) polygon shapes. So clip it with the + // initial polygon (in all cases aSmoothedPoly must be contained by m_Poly) + aSmoothedPoly.BooleanIntersection( *m_Poly, SHAPE_POLY_SET::PM_FAST ); break; default: