Browse Source

Track polygon clearance: use the new TransformOvalClearanceToPolygon function, to avoid underestimation of clearance areas.

(issue already found for oval pads)
Add some comments.
pull/5/merge
jean-pierre charras 8 years ago
parent
commit
81642dddd1
  1. 6
      common/convert_basic_shapes_to_polygon.cpp
  2. 10
      pcbnew/board_items_to_polygon_shape_transform.cpp
  3. 2
      pcbnew/zone_filler.cpp

6
common/convert_basic_shapes_to_polygon.cpp

@ -74,6 +74,12 @@ void TransformOvalClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
// so, later, we will clamp the polygonal shape with the bounding box
// of the segment.
int radius = aWidth / 2;
// Note if we want to compensate the radius reduction of a circle due to
// the segment approx, aCorrectionFactor must be calculated like this:
// For a circle the min radius is radius * cos( 2PI / s_CircleToSegmentsCount / 2)
// aCorrectionFactor is 1 /cos( PI/s_CircleToSegmentsCount )
radius = radius * aCorrectionFactor; // make segments outside the circles
// end point is the coordinate relative to aStart

10
pcbnew/board_items_to_polygon_shape_transform.cpp

@ -510,8 +510,8 @@ void DRAWSEGMENT::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerB
break;
case S_SEGMENT:
TransformRoundedEndsSegmentToPolygon( aCornerBuffer, m_Start, m_End,
aCircleToSegmentsCount, linewidth );
TransformOvalClearanceToPolygon( aCornerBuffer, m_Start, m_End, linewidth,
aCircleToSegmentsCount, aCorrectionFactor );
break;
case S_POLYGON:
@ -604,10 +604,10 @@ void TRACK::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
break;
default:
TransformRoundedEndsSegmentToPolygon( aCornerBuffer,
m_Start, m_End,
TransformOvalClearanceToPolygon( aCornerBuffer, m_Start, m_End,
m_Width + ( 2 * aClearanceValue),
aCircleToSegmentsCount,
m_Width + ( 2 * aClearanceValue) );
aCorrectionFactor );
break;
}
}

2
pcbnew/zone_filler.cpp

@ -282,7 +282,7 @@ void ZONE_FILLER::buildZoneFeatureHoleList( const ZONE_CONTAINER* aZone,
/* calculates the coeff to compensate radius reduction of holes clearance
* due to the segment approx.
* For a circle the min radius is radius * cos( 2PI / s_CircleToSegmentsCount / 2)
* s_Correction is 1 /cos( PI/s_CircleToSegmentsCount )
* correctionFactor is 1 /cos( PI/s_CircleToSegmentsCount )
*/
correctionFactor = 1.0 / cos( M_PI / (double) segsPerCircle );

Loading…
Cancel
Save