Improve moving, rendering and plotting of very small angle arcs.

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


(cherry picked from commit b905b4eac8)
This commit is contained in:
Alex Shvartzkop
2024-04-02 21:41:09 +00:00
committed by dsa-t
parent e0381f25f7
commit bac0820864
5 changed files with 42 additions and 12 deletions
+14 -3
View File
@@ -833,10 +833,21 @@ void GERBER_PLOTTER::Arc( const VECTOR2D& aCenter, const EDA_ANGLE& aStartAngle,
{
SetCurrentLineWidth( aWidth );
EDA_ANGLE endAngle = aStartAngle + aAngle;
double arcLength = std::abs( aRadius * aAngle.AsRadians() );
// aFill is not used here.
plotArc( aCenter, aStartAngle, endAngle, aRadius, false );
if( arcLength < 100 || std::abs( aAngle.AsDegrees() ) < 0.1 )
{
// Prevent plotting very short arcs as full circles, especially with 4.5 mm precision.
// Also reduce the risk of integer overflow issues.
polyArc( aCenter, aStartAngle, aAngle, aRadius, aFill, aWidth );
}
else
{
EDA_ANGLE endAngle = aStartAngle + aAngle;
// aFill is not used here.
plotArc( aCenter, aStartAngle, endAngle, aRadius, false );
}
}