3d-viewer: Approximate 0-length element is rrect
Apply same logic of using a filled circle to represent a zero-length element as a filled circle with radius of the line. Fixes: lp:1785823 * https://bugs.launchpad.net/kicad/+bug/1785823
This commit is contained in:
parent
618182dcd6
commit
8efcf81cf5
|
@ -418,28 +418,25 @@ void CINFO3D_VISU::createNewPadWithClearance( const D_PAD* aPad,
|
||||||
*aPad ) );
|
*aPad ) );
|
||||||
|
|
||||||
// Add the PAD contours
|
// Add the PAD contours
|
||||||
// !TODO: check the corners because it cannot add
|
// Round segments cannot have 0-length elements, so we approximate them
|
||||||
// roundsegments that are in the same start and end position
|
// as a small circle
|
||||||
aDstContainer->Add( new CROUNDSEGMENT2D( corners3DU[0],
|
for( int i = 1; i <= 4; i++ )
|
||||||
corners3DU[1],
|
{
|
||||||
|
if( Is_segment_a_circle( corners3DU[i - 1], corners3DU[i & 3] ) )
|
||||||
|
{
|
||||||
|
aDstContainer->Add( new CFILLEDCIRCLE2D( corners3DU[i - 1],
|
||||||
aClearanceValue.x * 2.0f * m_biuTo3Dunits,
|
aClearanceValue.x * 2.0f * m_biuTo3Dunits,
|
||||||
*aPad ) );
|
*aPad ) );
|
||||||
|
}
|
||||||
aDstContainer->Add( new CROUNDSEGMENT2D( corners3DU[1],
|
else
|
||||||
corners3DU[2],
|
{
|
||||||
aClearanceValue.x * 2.0f * m_biuTo3Dunits,
|
aDstContainer->Add( new CROUNDSEGMENT2D( corners3DU[i - 1],
|
||||||
*aPad ) );
|
corners3DU[i & 3],
|
||||||
|
|
||||||
aDstContainer->Add( new CROUNDSEGMENT2D( corners3DU[2],
|
|
||||||
corners3DU[3],
|
|
||||||
aClearanceValue.x * 2.0f * m_biuTo3Dunits,
|
|
||||||
*aPad ) );
|
|
||||||
|
|
||||||
aDstContainer->Add( new CROUNDSEGMENT2D( corners3DU[3],
|
|
||||||
corners3DU[0],
|
|
||||||
aClearanceValue.x * 2.0f * m_biuTo3Dunits,
|
aClearanceValue.x * 2.0f * m_biuTo3Dunits,
|
||||||
*aPad ) );
|
*aPad ) );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PAD_SHAPE_ROUNDRECT:
|
case PAD_SHAPE_ROUNDRECT:
|
||||||
|
@ -473,28 +470,25 @@ void CINFO3D_VISU::createNewPadWithClearance( const D_PAD* aPad,
|
||||||
*aPad ) );
|
*aPad ) );
|
||||||
|
|
||||||
// Add the PAD contours
|
// Add the PAD contours
|
||||||
// !TODO: check the corners because it cannot add
|
// Round segments cannot have 0-length elements, so we approximate them
|
||||||
// roundsegments that are in the same start and end position
|
// as a small circle
|
||||||
aDstContainer->Add( new CROUNDSEGMENT2D( corners3DU[0],
|
for( int i = 1; i <= 4; i++ )
|
||||||
corners3DU[1],
|
{
|
||||||
|
if( Is_segment_a_circle( corners3DU[i - 1], corners3DU[i & 3] ) )
|
||||||
|
{
|
||||||
|
aDstContainer->Add( new CFILLEDCIRCLE2D( corners3DU[i - 1],
|
||||||
rounding_radius * 2.0f * m_biuTo3Dunits,
|
rounding_radius * 2.0f * m_biuTo3Dunits,
|
||||||
*aPad ) );
|
*aPad ) );
|
||||||
|
}
|
||||||
aDstContainer->Add( new CROUNDSEGMENT2D( corners3DU[1],
|
else
|
||||||
corners3DU[2],
|
{
|
||||||
rounding_radius * 2.0f * m_biuTo3Dunits,
|
aDstContainer->Add( new CROUNDSEGMENT2D( corners3DU[i - 1],
|
||||||
*aPad ) );
|
corners3DU[i & 3],
|
||||||
|
|
||||||
aDstContainer->Add( new CROUNDSEGMENT2D( corners3DU[2],
|
|
||||||
corners3DU[3],
|
|
||||||
rounding_radius * 2.0f * m_biuTo3Dunits,
|
|
||||||
*aPad ) );
|
|
||||||
|
|
||||||
aDstContainer->Add( new CROUNDSEGMENT2D( corners3DU[3],
|
|
||||||
corners3DU[0],
|
|
||||||
rounding_radius * 2.0f * m_biuTo3Dunits,
|
rounding_radius * 2.0f * m_biuTo3Dunits,
|
||||||
*aPad ) );
|
*aPad ) );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PAD_SHAPE_CUSTOM:
|
case PAD_SHAPE_CUSTOM:
|
||||||
|
|
Loading…
Reference in New Issue