Track polygon clearance: use the new TransformOvalClearanceToPolygon function, to avoid underestimation of clearance areas.
(issue already found for oval pads) Add some comments.
This commit is contained in:
parent
2fd00b1d23
commit
81642dddd1
|
@ -74,6 +74,12 @@ void TransformOvalClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
|
||||||
// so, later, we will clamp the polygonal shape with the bounding box
|
// so, later, we will clamp the polygonal shape with the bounding box
|
||||||
// of the segment.
|
// of the segment.
|
||||||
int radius = aWidth / 2;
|
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
|
radius = radius * aCorrectionFactor; // make segments outside the circles
|
||||||
|
|
||||||
// end point is the coordinate relative to aStart
|
// end point is the coordinate relative to aStart
|
||||||
|
|
|
@ -510,8 +510,8 @@ void DRAWSEGMENT::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerB
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case S_SEGMENT:
|
case S_SEGMENT:
|
||||||
TransformRoundedEndsSegmentToPolygon( aCornerBuffer, m_Start, m_End,
|
TransformOvalClearanceToPolygon( aCornerBuffer, m_Start, m_End, linewidth,
|
||||||
aCircleToSegmentsCount, linewidth );
|
aCircleToSegmentsCount, aCorrectionFactor );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case S_POLYGON:
|
case S_POLYGON:
|
||||||
|
@ -604,10 +604,10 @@ void TRACK::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
TransformRoundedEndsSegmentToPolygon( aCornerBuffer,
|
TransformOvalClearanceToPolygon( aCornerBuffer, m_Start, m_End,
|
||||||
m_Start, m_End,
|
m_Width + ( 2 * aClearanceValue),
|
||||||
aCircleToSegmentsCount,
|
aCircleToSegmentsCount,
|
||||||
m_Width + ( 2 * aClearanceValue) );
|
aCorrectionFactor );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -282,7 +282,7 @@ void ZONE_FILLER::buildZoneFeatureHoleList( const ZONE_CONTAINER* aZone,
|
||||||
/* calculates the coeff to compensate radius reduction of holes clearance
|
/* calculates the coeff to compensate radius reduction of holes clearance
|
||||||
* due to the segment approx.
|
* due to the segment approx.
|
||||||
* For a circle the min radius is radius * cos( 2PI / s_CircleToSegmentsCount / 2)
|
* 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 );
|
correctionFactor = 1.0 / cos( M_PI / (double) segsPerCircle );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue