3d-viewer: Clamp inner radius of rings

Thick segments can cause radius to be set negative.  Effective radius of
these segments should be 0.

Fixes: lp:1803797
* https://bugs.launchpad.net/kicad/+bug/1803797
This commit is contained in:
Seth Hillbrand 2019-01-04 16:48:25 -08:00
parent 30521f0c57
commit a46f5c3af5
1 changed files with 2 additions and 1 deletions

View File

@ -763,7 +763,8 @@ void CINFO3D_VISU::AddShapeWithClearanceToContainer( const DRAWSEGMENT* aDrawSeg
const SFVEC2F center3DU( aDrawSegment->GetCenter().x * m_biuTo3Dunits,
-aDrawSegment->GetCenter().y * m_biuTo3Dunits );
const float inner_radius = (aDrawSegment->GetRadius() - linewidth / 2) * m_biuTo3Dunits;
const float inner_radius =
std::max<float>( (aDrawSegment->GetRadius() - linewidth / 2) * m_biuTo3Dunits, 0.0 );
const float outter_radius = (aDrawSegment->GetRadius() + linewidth / 2) * m_biuTo3Dunits;
aDstContainer->Add( new CRING2D( center3DU,