tesselation: Re-check polygon count after fracturing
The fracture() call may result in zero polygons remaining, which will cause failure in our tesselation routine, so we need to check whether this is a valid POLYGON before re-tesselating.
This commit is contained in:
parent
e5f5443762
commit
64f1fb9e79
|
@ -1882,11 +1882,15 @@ void SHAPE_POLY_SET::CacheTriangulation()
|
||||||
{
|
{
|
||||||
tmpSet.Fracture( PM_FAST );
|
tmpSet.Fracture( PM_FAST );
|
||||||
|
|
||||||
if( !tess.TesselatePolygon( tmpSet.Polygon( i ).front() ) )
|
// After fracturing, we may have zero or one polygon
|
||||||
|
// Check for zero polygons before tesselating and break regardless
|
||||||
|
if( !tmpSet.OutlineCount() || !tess.TesselatePolygon( tmpSet.Polygon( i ).front() ) )
|
||||||
{
|
{
|
||||||
m_triangulatedPolys.pop_back();
|
m_triangulatedPolys.pop_back();
|
||||||
m_triangulationValid = false;
|
m_triangulationValid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -649,8 +649,6 @@ public:
|
||||||
|
|
||||||
bool TesselatePolygon( const SHAPE_LINE_CHAIN& aPoly )
|
bool TesselatePolygon( const SHAPE_LINE_CHAIN& aPoly )
|
||||||
{
|
{
|
||||||
ClipperLib::Clipper c;
|
|
||||||
|
|
||||||
m_bbox = aPoly.BBox();
|
m_bbox = aPoly.BBox();
|
||||||
m_result.Clear();
|
m_result.Clear();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue