From a9d31348b16a766681f337e69ed54d2246582b6f Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sat, 24 Sep 2022 10:00:21 +0200 Subject: [PATCH] Eeschema, print and plot: fix arc issue for lib arcs == 180 deg Fixes #12502 https://gitlab.com/kicad/code/kicad/issues/12502 --- eeschema/lib_shape.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/eeschema/lib_shape.cpp b/eeschema/lib_shape.cpp index 306ef4fdd5..efa6b5fa02 100644 --- a/eeschema/lib_shape.cpp +++ b/eeschema/lib_shape.cpp @@ -167,7 +167,8 @@ void LIB_SHAPE::Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffs // N.B. The order of evaluation is critical here as MapAngles will modify t1, t2 // and the Normalize routine depends on these modifications for the correct output bool transformed = aTransform.MapAngles( &t1, &t2 ); - bool transformed2 = ( ( t1 - t2 ).Normalize180() > ANGLE_0 ); + EDA_ANGLE arc_angle = ( t1 - t2 ).Normalize180(); + bool transformed2 = ( arc_angle > ANGLE_0 ) && ( arc_angle < ANGLE_180 ); if( transformed != transformed2 ) std::swap( start, end ); @@ -329,7 +330,8 @@ void LIB_SHAPE::print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset // N.B. The order of evaluation is critical here as MapAngles will modify t1, t2 // and the Normalize routine depends on these modifications for the correct output bool transformed = aTransform.MapAngles( &t1, &t2 ); - bool transformed2 = ( ( t1 - t2 ).Normalize180() > ANGLE_0 ); + EDA_ANGLE arc_angle = ( t1 - t2 ).Normalize180(); + bool transformed2 = ( arc_angle > ANGLE_0 ) && ( arc_angle < ANGLE_180 ); if( transformed == transformed2 ) std::swap( pt1, pt2 );