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

Fixes https://gitlab.com/kicad/code/kicad/-/issues/17343
This commit is contained in:
Alex Shvartzkop
2024-03-09 02:07:24 +03:00
parent d1d9636598
commit 4d66a8ebdb
6 changed files with 24 additions and 19 deletions
+5 -5
View File
@@ -879,19 +879,19 @@ void GERBER_PLOTTER::plotArc( const SHAPE_ARC& aArc, bool aPlotInRegion )
void GERBER_PLOTTER::plotArc( const VECTOR2I& aCenter, const EDA_ANGLE& aStartAngle,
const EDA_ANGLE& aEndAngle, int aRadius, bool aPlotInRegion )
const EDA_ANGLE& aEndAngle, double aRadius, bool aPlotInRegion )
{
VECTOR2I start, end;
start.x = aCenter.x + KiROUND( aRadius * aStartAngle.Cos() );
start.y = aCenter.y + KiROUND( aRadius * aStartAngle.Sin() );
start.x = KiROUND( aCenter.x + aRadius * aStartAngle.Cos() );
start.y = KiROUND( aCenter.y + aRadius * aStartAngle.Sin() );
if( !aPlotInRegion )
MoveTo( start );
else
LineTo( start );
end.x = aCenter.x + KiROUND( aRadius * aEndAngle.Cos() );
end.y = aCenter.y + KiROUND( aRadius * aEndAngle.Sin() );
end.x = KiROUND( aCenter.x + aRadius * aEndAngle.Cos() );
end.y = KiROUND( aCenter.y + aRadius * aEndAngle.Sin() );
VECTOR2D devEnd = userToDeviceCoordinates( end );
// devRelCenter is the position on arc center relative to the arc start, in Gerber coord.
VECTOR2D devRelCenter = userToDeviceCoordinates( aCenter ) - userToDeviceCoordinates( start );