From 0a9aedda8b9cfb95f7d8df576aab0da9dcdd21dd Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Tue, 18 Sep 2018 04:12:55 -0700 Subject: [PATCH] 3d-viewer: Require simplified polygons 3d viewer requires simplified polygons not just for triangulation but also for its own internal routines. Fixes: lp:1793085 * https://bugs.launchpad.net/kicad/+bug/1793085 (cherry picked from commit 8999f4604f770112dce5f0dda671ad274bad26fb) --- 3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp b/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp index 3386baf1a2..369d1abcd4 100644 --- a/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp +++ b/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp @@ -820,6 +820,8 @@ void CINFO3D_VISU::AddShapeWithClearanceToContainer( const DRAWSEGMENT* aDrawSeg aDrawSegment->TransformShapeWithClearanceToPolygon( polyList, aClearanceValue, segcountforcircle, correctionFactor ); + polyList.Simplify( SHAPE_POLY_SET::PM_FAST ); + if( polyList.IsEmpty() ) // Just for caution break; @@ -846,6 +848,10 @@ void CINFO3D_VISU::AddSolidAreasShapesToContainer( const ZONE_CONTAINER* aZoneCo { // Copy the polys list because we have to simplify it SHAPE_POLY_SET polyList = SHAPE_POLY_SET(aZoneContainer->GetFilledPolysList()); + polyList.Simplify( SHAPE_POLY_SET::PM_FAST ); + + if( polyList.IsEmpty() ) + return; // This convert the poly in outline and holes Convert_shape_line_polygon_to_triangles( polyList, @@ -853,7 +859,6 @@ void CINFO3D_VISU::AddSolidAreasShapesToContainer( const ZONE_CONTAINER* aZoneCo m_biuTo3Dunits, *aZoneContainer ); - // add filled areas outlines, which are drawn with thick lines segments // ///////////////////////////////////////////////////////////////////////// for( int i = 0; i < polyList.OutlineCount(); ++i )