From 3ac121620dd10de442473ce39bec9b81a1b99fdd Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Thu, 24 Feb 2022 17:26:21 -0800 Subject: [PATCH] Handle negative arc angles Plotter expects the arc angles to be positive, so check and flip before plotting if we have track arcs that might be negative angles Fixes https://gitlab.com/kicad/code/kicad/issues/10968 --- pcbnew/plot_board_layers.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/pcbnew/plot_board_layers.cpp b/pcbnew/plot_board_layers.cpp index f8f6ed8f99..c902ca5c94 100644 --- a/pcbnew/plot_board_layers.cpp +++ b/pcbnew/plot_board_layers.cpp @@ -579,14 +579,19 @@ void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask, if( track->Type() == PCB_ARC_T ) { const PCB_ARC* arc = static_cast( track ); - PCB_SHAPE arc_shape( nullptr, SHAPE_T::ARC ); - arc_shape.SetWidth( width ); - arc_shape.SetStart( arc->GetStart() ); - arc_shape.SetEnd( arc->GetEnd() ); - arc_shape.SetCenter( arc->GetCenter() ); - aPlotter->ThickArc( arc->GetCenter(), arc->GetStart(), arc->GetEnd(), - width, plotMode, &gbr_metadata ); + // ThickArc expects only positive angle arcs, so flip start/end if + // we are negative + if( arc->GetAngle() < ANGLE_0 ) + { + aPlotter->ThickArc( arc->GetCenter(), arc->GetEnd(), arc->GetStart(), + width, plotMode, &gbr_metadata ); + } + else + { + aPlotter->ThickArc( arc->GetCenter(), arc->GetStart(), arc->GetEnd(), + width, plotMode, &gbr_metadata ); + } } else {