From bf9d085c15d86f5d1863c6266262eb15bf342395 Mon Sep 17 00:00:00 2001 From: Alex Date: Sun, 11 Feb 2024 23:45:03 +0300 Subject: [PATCH] EasyEDA schematic import: fix nan center for elliptic arcs. --- eeschema/sch_io/easyeda/sch_easyeda_parser.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/eeschema/sch_io/easyeda/sch_easyeda_parser.cpp b/eeschema/sch_io/easyeda/sch_easyeda_parser.cpp index f75aef8ee1..7450385538 100644 --- a/eeschema/sch_io/easyeda/sch_easyeda_parser.cpp +++ b/eeschema/sch_io/easyeda/sch_easyeda_parser.cpp @@ -660,12 +660,9 @@ void SCH_EASYEDA_PARSER::ParseSymbolShapes( LIB_SYMBOL* aSymbol VECTOR2D delta = end - start; + double avgRad = ( rad.x + rad.y ) / 2; double d = delta.EuclideanNorm(); - double h = sqrt( rad.x * rad.x - d * d / 4 ); - - //double aa = sqrt(1/(d*d)* ( 4*d*d*rad - d*d*d*d)); - - //double h = sqrt( radX - d * d / 4 ); + double h = sqrt( std::max( 0.0, avgRad * avgRad - d * d / 4 ) ); //( !far && cw ) => h //( far && cw ) => -h