Fix ellipse angles when importing DXF.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18121


(cherry picked from commit 044a2305e3)

Co-authored-by: Alex Shvartzkop <dudesuchamazing@gmail.com>
This commit is contained in:
dsa-t 2024-06-04 04:19:51 +00:00
parent 590bd6237d
commit ca18112041
1 changed files with 4 additions and 4 deletions

View File

@ -642,10 +642,6 @@ void DXF_IMPORT_PLUGIN::addEllipse( const DL_EllipseData& aData )
if( startAngle > endAngle ) if( startAngle > endAngle )
endAngle += ANGLE_360; endAngle += ANGLE_360;
// Angles are relative to major axis
startAngle -= EDA_ANGLE( major );
endAngle -= EDA_ANGLE( major );
if( aData.ratio == 1.0 ) if( aData.ratio == 1.0 )
{ {
double radius = major.EuclideanNorm(); double radius = major.EuclideanNorm();
@ -658,6 +654,10 @@ void DXF_IMPORT_PLUGIN::addEllipse( const DL_EllipseData& aData )
} }
else else
{ {
// Angles are relative to major axis
startAngle -= EDA_ANGLE( major );
endAngle -= EDA_ANGLE( major );
DL_ArcData arc( aData.cx, aData.cy, aData.cz, radius, startAngle.AsDegrees(), DL_ArcData arc( aData.cx, aData.cy, aData.cz, radius, startAngle.AsDegrees(),
endAngle.AsDegrees() ); endAngle.AsDegrees() );
addArc( arc ); addArc( arc );