Make polygon built by BOARD::GetBoardPolygonOutlines strictly simple.

It fixes issues in 3d viewer (crashes and incorrect 3D board outline in some cases)

Fixes: lp:167484
https://bugs.launchpad.net/kicad/+bug/1674844
This commit is contained in:
jean-pierre charras 2017-03-23 08:56:52 +01:00
parent 9fe780f1b3
commit 68b141dcb8
2 changed files with 10 additions and 1 deletions

View File

@ -484,6 +484,9 @@ void CINFO3D_VISU::createBoardPolygon()
wxLogMessage( errmsg ); wxLogMessage( errmsg );
} }
// Be sure the polygon is strictly simple to avoid issues.
m_board_poly.Simplify( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
Polygon_Calc_BBox_3DU( m_board_poly, m_board2dBBox3DU, m_biuTo3Dunits ); Polygon_Calc_BBox_3DU( m_board_poly, m_board2dBBox3DU, m_biuTo3Dunits );
} }

View File

@ -2881,5 +2881,11 @@ extern bool BuildBoardPolygonOutlines( BOARD* aBoard,
bool BOARD::GetBoardPolygonOutlines( SHAPE_POLY_SET& aOutlines, bool BOARD::GetBoardPolygonOutlines( SHAPE_POLY_SET& aOutlines,
wxString* aErrorText ) wxString* aErrorText )
{ {
return BuildBoardPolygonOutlines( this, aOutlines, aErrorText ); bool success = BuildBoardPolygonOutlines( this, aOutlines, aErrorText );
// Make polygon strictly simple to avoid issues (especially in 3D viewer)
aOutlines.Simplify( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
return success;
} }