From 064303e238d23e46e20aa79c1d726cdafd05122f Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Thu, 3 Jan 2019 05:22:32 -0700 Subject: [PATCH] pcbnew: Move zone-knockout to default high def Most rounding operations have been shifted to an absolute error calculation and the ability to adjust zone segment counts has been removed in 5.1. The remaining elements that use fixed segment counts are either 18 (DRC) or 32 (plotting). This aligns the punchout segment count with the higher (32) definition value --- pcbnew/zone_filler.cpp | 23 ++++++++--------------- pcbnew/zone_settings.cpp | 2 +- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/pcbnew/zone_filler.cpp b/pcbnew/zone_filler.cpp index 9681a69c1e..1a07341e74 100644 --- a/pcbnew/zone_filler.cpp +++ b/pcbnew/zone_filler.cpp @@ -312,21 +312,19 @@ bool ZONE_FILLER::Fill( std::vector aZones, bool aCheck ) void ZONE_FILLER::buildZoneFeatureHoleList( const ZONE_CONTAINER* aZone, SHAPE_POLY_SET& aFeatures ) const { - int segsPerCircle; - double correctionFactor; - // Set the number of segments in arc approximations - if( aZone->GetArcSegmentCount() > SEGMENT_COUNT_CROSSOVER ) - segsPerCircle = ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF; - else - segsPerCircle = ARC_APPROX_SEGMENTS_COUNT_LOW_DEF; + // Since we can no longer edit the segment count in pcbnew, we set + // the fill to our high-def count to avoid jagged knock-outs + // However, if the user has edited their zone to increase the segment count, + // we keep this preference + int segsPerCircle = std::max( aZone->GetArcSegmentCount(), ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF ); /* calculates the coeff to compensate radius reduction of holes clearance * due to the segment approx. * For a circle the min radius is radius * cos( 2PI / segsPerCircle / 2) * correctionFactor is 1 /cos( PI/segsPerCircle ) */ - correctionFactor = GetCircletoPolyCorrectionFactor( segsPerCircle ); + double correctionFactor = GetCircletoPolyCorrectionFactor( segsPerCircle ); aFeatures.RemoveAllContours(); @@ -701,22 +699,17 @@ void ZONE_FILLER::computeRawFilledAreas( const ZONE_CONTAINER* aZone, SHAPE_POLY_SET& aRawPolys, SHAPE_POLY_SET& aFinalPolys ) const { - int segsPerCircle; - double correctionFactor; int outline_half_thickness = aZone->GetMinThickness() / 2; std::unique_ptr dumper( new SHAPE_FILE_IO( s_DumpZonesWhenFilling ? "zones_dump.txt" : "", SHAPE_FILE_IO::IOM_APPEND ) ); // Set the number of segments in arc approximations - if( aZone->GetArcSegmentCount() == ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF ) - segsPerCircle = ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF; - else - segsPerCircle = ARC_APPROX_SEGMENTS_COUNT_LOW_DEF; + int segsPerCircle = std::max( aZone->GetArcSegmentCount(), ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF ); /* calculates the coeff to compensate radius reduction of holes clearance */ - correctionFactor = GetCircletoPolyCorrectionFactor( segsPerCircle ); + double correctionFactor = GetCircletoPolyCorrectionFactor( segsPerCircle ); if( s_DumpZonesWhenFilling ) dumper->BeginGroup( "clipper-zone" ); diff --git a/pcbnew/zone_settings.cpp b/pcbnew/zone_settings.cpp index 0603a273d1..be59a8fd6a 100644 --- a/pcbnew/zone_settings.cpp +++ b/pcbnew/zone_settings.cpp @@ -51,7 +51,7 @@ ZONE_SETTINGS::ZONE_SETTINGS() m_CurrentZone_Layer = F_Cu; // Layer used to create the current zone m_Zone_HatchingStyle = ZONE_CONTAINER::DIAGONAL_EDGE; // Option to show the zone area (outlines only, short hatches or full hatches - m_ArcToSegmentsCount = ARC_APPROX_SEGMENTS_COUNT_LOW_DEF; // Option to select number of segments to approximate a circle + m_ArcToSegmentsCount = ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF; // Option to select number of segments to approximate a circle // ARC_APPROX_SEGMENTS_COUNT_LOW_DEF // or ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF segments