Round-rect pads: use a circle to draw degenerated shapes.

A degenerated shape is a round-rect pads with same X and Y size, and a
radius very near 50% of the size.

Fixes #5768
https://gitlab.com/kicad/code/kicad/issues/5768
This commit is contained in:
jean-pierre charras 2020-09-24 11:05:56 +02:00
parent aa6158a9fb
commit 446a9ca866
1 changed files with 12 additions and 0 deletions

View File

@ -347,7 +347,19 @@ void D_PAD::BuildEffectiveShapes( PCB_LAYER_ID aLayer ) const
wxSize trap_delta( 0, 0 );
if( effectiveShape == PAD_SHAPE_ROUNDRECT )
{
half_size -= wxPoint( r, r );
// Avoid degenerated shapes (0 length segments) that always create issues
// For roundrect pad very near a circle, use only a circle
const int min_len = Millimeter2iu( 0.0001);
if( half_size.x < min_len && half_size.y < min_len )
{
add( new SHAPE_CIRCLE( shapePos, r ) );
break;
}
}
else if( effectiveShape == PAD_SHAPE_TRAPEZOID )
trap_delta = m_deltaSize / 2;