3D viewer: fix an issue with solder paste layer having negative clearance.
The code tried to draw outlines with segments having a negative thickness. It happens mainly on solder paste layers. Fixes #4090 https://gitlab.com/kicad/code/kicad/issues/4090
This commit is contained in:
parent
6e27904791
commit
04d6ea982d
|
@ -376,9 +376,22 @@ void EDA_3D_SETTINGS::createNewPadWithClearance( const D_PAD* aPad,
|
|||
case PAD_SHAPE_RECT:
|
||||
{
|
||||
// see pcbnew/board_items_to_polygon_shape_transform.cpp
|
||||
|
||||
wxPoint corners[4];
|
||||
aPad->BuildPadPolygon( corners, aClearanceValue, aPad->GetOrientation() );
|
||||
bool drawOutline;
|
||||
|
||||
// For aClearanceValue.x == aClearanceValue.y and > 0 we use the pad shape
|
||||
// and draw outlines with thicknes = aClearanceValue.
|
||||
// Otherwise we draw only the inflated/deflated shape
|
||||
if( aClearanceValue.x > 0 && aClearanceValue.x == aClearanceValue.y )
|
||||
{
|
||||
drawOutline = true;
|
||||
aPad->BuildPadPolygon( corners, wxSize( 0, 0 ), aPad->GetOrientation() );
|
||||
}
|
||||
else
|
||||
{
|
||||
drawOutline = false;
|
||||
aPad->BuildPadPolygon( corners, aClearanceValue, aPad->GetOrientation() );
|
||||
}
|
||||
|
||||
SFVEC2F corners3DU[4];
|
||||
|
||||
|
@ -406,20 +419,23 @@ void EDA_3D_SETTINGS::createNewPadWithClearance( const D_PAD* aPad,
|
|||
// Add the PAD contours
|
||||
// Round segments cannot have 0-length elements, so we approximate them
|
||||
// as a small circle
|
||||
for( int i = 1; i <= 4; i++ )
|
||||
if( drawOutline )
|
||||
{
|
||||
if( Is_segment_a_circle( corners3DU[i - 1], corners3DU[i & 3] ) )
|
||||
for( int i = 1; i <= 4; i++ )
|
||||
{
|
||||
aDstContainer->Add( new CFILLEDCIRCLE2D( corners3DU[i - 1],
|
||||
aClearanceValue.x * m_biuTo3Dunits,
|
||||
*aPad ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
aDstContainer->Add( new CROUNDSEGMENT2D( corners3DU[i - 1],
|
||||
corners3DU[i & 3],
|
||||
aClearanceValue.x * 2.0f * m_biuTo3Dunits,
|
||||
*aPad ) );
|
||||
if( Is_segment_a_circle( corners3DU[i - 1], corners3DU[i & 3] ) )
|
||||
{
|
||||
aDstContainer->Add( new CFILLEDCIRCLE2D( corners3DU[i - 1],
|
||||
aClearanceValue.x * m_biuTo3Dunits,
|
||||
*aPad ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
aDstContainer->Add( new CROUNDSEGMENT2D( corners3DU[i - 1],
|
||||
corners3DU[i & 3],
|
||||
aClearanceValue.x * 2.0f * m_biuTo3Dunits,
|
||||
*aPad ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,6 @@ void EDA_3D_SETTINGS::buildPadShapePolygon( const D_PAD* aPad,
|
|||
SHAPE_POLY_SET& aCornerBuffer,
|
||||
wxSize aInflateValue ) const
|
||||
{
|
||||
wxPoint corners[4];
|
||||
wxPoint PadShapePos = aPad->ShapePos(); /* Note: for pad having a shape offset,
|
||||
* the pad position is NOT the shape position */
|
||||
switch( aPad->GetShape() )
|
||||
|
@ -68,6 +67,7 @@ void EDA_3D_SETTINGS::buildPadShapePolygon( const D_PAD* aPad,
|
|||
case PAD_SHAPE_TRAPEZOID:
|
||||
case PAD_SHAPE_RECT:
|
||||
{
|
||||
wxPoint corners[4];
|
||||
SHAPE_LINE_CHAIN aLineChain;
|
||||
|
||||
aPad->BuildPadPolygon( corners, aInflateValue, aPad->GetOrientation() );
|
||||
|
|
Loading…
Reference in New Issue