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
This commit is contained in:
Seth Hillbrand 2022-02-24 17:26:21 -08:00
parent 67eb138a4b
commit 3ac121620d
1 changed files with 12 additions and 7 deletions

View File

@ -579,14 +579,19 @@ void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask,
if( track->Type() == PCB_ARC_T ) if( track->Type() == PCB_ARC_T )
{ {
const PCB_ARC* arc = static_cast<const PCB_ARC*>( track ); const PCB_ARC* arc = static_cast<const PCB_ARC*>( 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(), // ThickArc expects only positive angle arcs, so flip start/end if
width, plotMode, &gbr_metadata ); // 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 else
{ {