diff --git a/pcbnew/board_items_to_polygon_shape_transform.cpp b/pcbnew/board_items_to_polygon_shape_transform.cpp index 278b68f4c3..8724b32f74 100644 --- a/pcbnew/board_items_to_polygon_shape_transform.cpp +++ b/pcbnew/board_items_to_polygon_shape_transform.cpp @@ -509,22 +509,25 @@ void DRAWSEGMENT::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerB // The full width of the lines to create: int linewidth = m_Width + (2 * aClearanceValue); + // Creating a reliable clearance shape for circles and arcs is not so easy, due to + // the error created by segment approximation. + // for a cicle this is not so hard: create a polygon from a circle slightly bigger: + // thickness = linewidth + s_error_max, and radius = initial radius + s_error_max/2 + // giving a shape with a suitable internal radius and external radius + // For an arc this is more tricky: TODO if( m_Shape == S_CIRCLE || m_Shape == S_ARC ) { int segCount = GetArcToSegmentCount( GetRadius(), s_error_max, 360.0 ); if( segCount > aCircleToSegmentsCount ) - { aCircleToSegmentsCount = segCount; - aCorrectionFactor = GetCircletoPolyCorrectionFactor( aCircleToSegmentsCount ); - } } switch( m_Shape ) { case S_CIRCLE: - TransformRingToPolygon( aCornerBuffer, GetCenter(), GetRadius(), - aCircleToSegmentsCount, linewidth ) ; + TransformRingToPolygon( aCornerBuffer, GetCenter(), GetRadius() + (s_error_max/2), + aCircleToSegmentsCount, linewidth + s_error_max ) ; break; case S_ARC: diff --git a/pcbnew/convert_drawsegment_list_to_polygon.cpp b/pcbnew/convert_drawsegment_list_to_polygon.cpp index 26a6eed19c..32e8bb9e08 100644 --- a/pcbnew/convert_drawsegment_list_to_polygon.cpp +++ b/pcbnew/convert_drawsegment_list_to_polygon.cpp @@ -38,6 +38,12 @@ #include +// Error max when converting a circle or arc to segments. +// Avoid too small values that create a very long calculation time +// in zone fillings +#define ARC_ACCURACY ( 0.05 * IU_PER_MM ) + + /** * Function close_ness * is a non-exact distance (also called Manhattan distance) used to approximate @@ -168,12 +174,6 @@ static DRAWSEGMENT* findPoint( const wxPoint& aPoint, std::vector< DRAWSEGMENT* } -// Error max when converting a circle or arc to segments. -// Avoid too small values that create a very long calculation time -// in zone fillings -#define ARC_ACCURACY ( 0.05 * IU_PER_MM ) - - /** * Function ConvertOutlineToPolygon * build a polygon (with holes) from a DRAWSEGMENT list, which is expected to be