Fix rendering/plotting of arcs with tiny angle and huge radius.

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

(cherry picked from commit 4d66a8ebdb)
This commit is contained in:
Alex Shvartzkop
2024-03-15 01:17:50 +03:00
parent ed89827908
commit 6df17bba99
6 changed files with 24 additions and 19 deletions
+6 -6
View File
@@ -354,21 +354,21 @@ void PDF_PLOTTER::Arc( const VECTOR2D& aCenter, const EDA_ANGLE& aStartAngle,
SetCurrentLineWidth( aWidth );
// Usual trig arc plotting routine...
start.x = aCenter.x + KiROUND( aRadius * (-startAngle).Cos() );
start.y = aCenter.y + KiROUND( aRadius * (-startAngle).Sin() );
start.x = KiROUND( aCenter.x + aRadius * ( -startAngle ).Cos() );
start.y = KiROUND( aCenter.y + aRadius * ( -startAngle ).Sin() );
VECTOR2D pos_dev = userToDeviceCoordinates( start );
fprintf( m_workFile, "%g %g m ", pos_dev.x, pos_dev.y );
for( EDA_ANGLE ii = startAngle + delta; ii < endAngle; ii += delta )
{
end.x = aCenter.x + KiROUND( aRadius * (-ii).Cos() );
end.y = aCenter.y + KiROUND( aRadius * (-ii).Sin() );
end.x = KiROUND( aCenter.x + aRadius * ( -ii ).Cos() );
end.y = KiROUND( aCenter.y + aRadius * ( -ii ).Sin() );
pos_dev = userToDeviceCoordinates( end );
fprintf( m_workFile, "%g %g l ", pos_dev.x, pos_dev.y );
}
end.x = aCenter.x + KiROUND( aRadius * (-endAngle).Cos() );
end.y = aCenter.y + KiROUND( aRadius * (-endAngle).Sin() );
end.x = KiROUND( aCenter.x + aRadius * ( -endAngle ).Cos() );
end.y = KiROUND( aCenter.y + aRadius * ( -endAngle ).Sin() );
pos_dev = userToDeviceCoordinates( end );
fprintf( m_workFile, "%g %g l ", pos_dev.x, pos_dev.y );