From 830c5e7db740095ca0b63f5af2b92cc738902552 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Mon, 5 Nov 2018 08:30:54 +0100 Subject: [PATCH] 3D viewer: ensure 0 sized circles (that crash the viewer) are skipped. --- .../3d_canvas/create_3Dgraphic_brd_items.cpp | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp b/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp index 6a55a3fe2f..32ce2e6b51 100644 --- a/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp +++ b/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp @@ -871,10 +871,11 @@ void CINFO3D_VISU::AddSolidAreasShapesToContainer( const ZONE_CONTAINER* aZoneCo if( Is_segment_a_circle( start3DU, end3DU ) ) { - aDstContainer->Add( new CFILLEDCIRCLE2D( start3DU, - (aZoneContainer->GetMinThickness() / 2) * - m_biuTo3Dunits, - *aZoneContainer ) ); + float radius = (aZoneContainer->GetMinThickness() / 2) * m_biuTo3Dunits; + + if( radius > 0.0 ) // degenerated circles crash 3D viewer + aDstContainer->Add( new CFILLEDCIRCLE2D( start3DU, radius , + *aZoneContainer ) ); } else { @@ -900,11 +901,12 @@ void CINFO3D_VISU::AddSolidAreasShapesToContainer( const ZONE_CONTAINER* aZoneCo if( Is_segment_a_circle( start3DU, end3DU ) ) { - aDstContainer->Add( - new CFILLEDCIRCLE2D( start3DU, - (aZoneContainer->GetMinThickness() / 2) * - m_biuTo3Dunits, - *aZoneContainer ) ); + float radius = (aZoneContainer->GetMinThickness() / 2) * m_biuTo3Dunits; + + if( radius > 0.0 ) // degenerated circles crash 3D viewer + aDstContainer->Add( + new CFILLEDCIRCLE2D( start3DU, radius, + *aZoneContainer ) ); } else {