SHAPE_ARC::ConvertToPolyline(): fix ugly approximation for some arcs.

Arcs with small radius can be approximated with very few segments.
However, if the thickness is large, relative to the radius, the approximation
must be based on the external radius, not the arc radius.
The difference can be significant.
This is especially noticeable for these graphic arcs in filled zones.
This commit is contained in:
jean-pierre charras 2021-06-23 18:28:16 +02:00
parent 3269f45776
commit 1d6ad4a52a
1 changed files with 6 additions and 2 deletions

View File

@ -424,10 +424,14 @@ const SHAPE_LINE_CHAIN SHAPE_ARC::ConvertToPolyline( double aAccuracy ) const
int n;
if( r < aAccuracy )
// To calculate the arc to segment count, use the external radius instead of the radius.
// for a arc with small radius and large width, the difference can be significant
double external_radius = r+(m_width/2);
if( external_radius < aAccuracy )
n = 0;
else
n = GetArcToSegmentCount( r, aAccuracy, ca );
n = GetArcToSegmentCount( external_radius, aAccuracy, ca );
// Split the error on either side of the arc. Since we want the start and end points
// to be exactly on the arc, the first and last segments need to be shorter to stay within