From 25f8b1ce72277d232b7c8d5434b78a3793407295 Mon Sep 17 00:00:00 2001
From: Seth Hillbrand <hillbrand@ucdavis.edu>
Date: Thu, 3 Jan 2019 17:34:59 -0800
Subject: [PATCH] pcbnew: Update multiple zone segments

Where we can get away with lower segment counts (localizing an anchor),
we keep the low-def 16 segment count.  Intermediate values and values
that are visible to the user are set to high definition.  Most are
simply hints to the inflation correction but where they show, the user
show see smooth lines.
---
 3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp | 2 +-
 pcbnew/board_items_to_polygon_shape_transform.cpp  | 2 +-
 pcbnew/class_zone.cpp                              | 2 +-
 pcbnew/drc.cpp                                     | 4 ++--
 pcbnew/microwave/microwave_inductor.cpp            | 2 +-
 pcbnew/pad_custom_shape_functions.cpp              | 2 +-
 pcbnew/zone_filler.cpp                             | 2 +-
 7 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp b/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp
index 32ce2e6b51..e4b1069ed8 100644
--- a/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp
+++ b/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp
@@ -815,7 +815,7 @@ void CINFO3D_VISU::AddShapeWithClearanceToContainer( const DRAWSEGMENT* aDrawSeg
     case S_CURVE:
     case S_POLYGON:
     {
-        const int segcountforcircle = 16;
+        const int segcountforcircle = ARC_APPROX_SEGMENTS_COUNT_HIGH_DEF;
         const double correctionFactor = GetCircleCorrectionFactor( segcountforcircle );
         SHAPE_POLY_SET polyList;
 
diff --git a/pcbnew/board_items_to_polygon_shape_transform.cpp b/pcbnew/board_items_to_polygon_shape_transform.cpp
index 6b15626343..dde7a7e64b 100644
--- a/pcbnew/board_items_to_polygon_shape_transform.cpp
+++ b/pcbnew/board_items_to_polygon_shape_transform.cpp
@@ -80,7 +80,7 @@ static void addTextSegmToPoly( int x0, int y0, int xf, int yf, void* aData )
 void BOARD::ConvertBrdLayerToPolygonalContours( PCB_LAYER_ID aLayer, SHAPE_POLY_SET& aOutlines )
 {
     // Number of segments to convert a circle to a polygon
-    const int       segcountforcircle   = 18;
+    const int       segcountforcircle   = ARC_APPROX_SEGMENTS_COUNT_HIGH_DEF;
     double          correctionFactor    = GetCircletoPolyCorrectionFactor( segcountforcircle );
 
     // convert tracks and vias:
diff --git a/pcbnew/class_zone.cpp b/pcbnew/class_zone.cpp
index 7823e1d985..1ea8690907 100644
--- a/pcbnew/class_zone.cpp
+++ b/pcbnew/class_zone.cpp
@@ -1341,7 +1341,7 @@ void ZONE_CONTAINER::TransformOutlinesShapeWithClearanceToPolygon(
     // Calculate the polygon with clearance
     // holes are linked to the main outline, so only one polygon is created.
     if( clearance )
-        polybuffer.Inflate( clearance, 16 );
+        polybuffer.Inflate( clearance, ARC_APPROX_SEGMENTS_COUNT_HIGH_DEF );
 
     polybuffer.Fracture( SHAPE_POLY_SET::PM_FAST );
     aCornerBuffer.Append( polybuffer );
diff --git a/pcbnew/drc.cpp b/pcbnew/drc.cpp
index 616d73a3a9..31c696e7a7 100644
--- a/pcbnew/drc.cpp
+++ b/pcbnew/drc.cpp
@@ -1087,7 +1087,7 @@ void DRC::testCopperDrawItem( DRAWSEGMENT* aItem )
         if( !pad->IsOnLayer( aItem->GetLayer() ) )
             continue;
 
-        const int      segmentCount = 18;
+        const int      segmentCount = ARC_APPROX_SEGMENTS_COUNT_HIGH_DEF;
         double         correctionFactor = GetCircletoPolyCorrectionFactor( segmentCount );
         SHAPE_POLY_SET padOutline;
 
@@ -1153,7 +1153,7 @@ void DRC::testCopperTextItem( BOARD_ITEM* aTextItem )
         if( !pad->IsOnLayer( aTextItem->GetLayer() ) )
             continue;
 
-        const int      segmentCount = 18;
+        const int      segmentCount = ARC_APPROX_SEGMENTS_COUNT_HIGH_DEF;
         double         correctionFactor = GetCircletoPolyCorrectionFactor( segmentCount );
         SHAPE_POLY_SET padOutline;
 
diff --git a/pcbnew/microwave/microwave_inductor.cpp b/pcbnew/microwave/microwave_inductor.cpp
index e33011fdf4..d5a8d81c2c 100644
--- a/pcbnew/microwave/microwave_inductor.cpp
+++ b/pcbnew/microwave/microwave_inductor.cpp
@@ -52,7 +52,7 @@ static void gen_arc( std::vector <wxPoint>& aBuffer,
                      const wxPoint&         aCenter,
                      int                     a_ArcAngle )
 {
-    const int SEGM_COUNT_PER_360DEG = 16;
+    const int SEGM_COUNT_PER_360DEG = ARC_APPROX_SEGMENTS_COUNT_LOW_DEF;
     auto    first_point = aStartPoint - aCenter;
     int     seg_count   = ( ( abs( a_ArcAngle ) ) * SEGM_COUNT_PER_360DEG ) / 3600;
 
diff --git a/pcbnew/pad_custom_shape_functions.cpp b/pcbnew/pad_custom_shape_functions.cpp
index 1c98bd39ee..fe46c0b1b1 100644
--- a/pcbnew/pad_custom_shape_functions.cpp
+++ b/pcbnew/pad_custom_shape_functions.cpp
@@ -329,7 +329,7 @@ bool D_PAD::GetBestAnchorPosition( VECTOR2I& aPos )
 {
     SHAPE_POLY_SET poly;
 
-    if ( !buildCustomPadPolygon( &poly, 16 ) )
+    if ( !buildCustomPadPolygon( &poly, ARC_APPROX_SEGMENTS_COUNT_LOW_DEF ) )
         return false;
 
     const int minSteps = 10;
diff --git a/pcbnew/zone_filler.cpp b/pcbnew/zone_filler.cpp
index 044cf8b8cf..01c0155436 100644
--- a/pcbnew/zone_filler.cpp
+++ b/pcbnew/zone_filler.cpp
@@ -814,7 +814,7 @@ bool ZONE_FILLER::fillSingleZone( const ZONE_CONTAINER* aZone, SHAPE_POLY_SET& a
     {
         aRawPolys = smoothedPoly;
         aFinalPolys = smoothedPoly;
-        aFinalPolys.Inflate( -aZone->GetMinThickness() / 2, 16 );
+        aFinalPolys.Inflate( -aZone->GetMinThickness() / 2, ARC_APPROX_SEGMENTS_COUNT_HIGH_DEF );
         aFinalPolys.Fracture( SHAPE_POLY_SET::PM_FAST );
     }