Handle cases where Simplify removes all outlines
This could theoretically happen for a fully degenerate polygon
Fixes https://gitlab.com/kicad/code/kicad/issues/12120
(cherry picked from commit 5a37211fdb
)
This commit is contained in:
parent
b72675ba92
commit
b324abefe5
|
@ -503,8 +503,8 @@ void BITMAPCONV_INFO::createOutputData( BMP2CMP_MOD_LAYER aModLayer )
|
|||
polyset_areas.BooleanSubtract( polyset_holes, SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
|
||||
|
||||
// Ensure there are no self intersecting polygons
|
||||
polyset_areas.NormalizeAreaOutlines();
|
||||
|
||||
if( polyset_areas.NormalizeAreaOutlines() )
|
||||
{
|
||||
// Convert polygon with holes to a unique polygon
|
||||
polyset_areas.Fracture( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
|
||||
|
||||
|
@ -519,6 +519,7 @@ void BITMAPCONV_INFO::createOutputData( BMP2CMP_MOD_LAYER aModLayer )
|
|||
polyset_holes.RemoveAllContours();
|
||||
main_outline = true;
|
||||
}
|
||||
}
|
||||
|
||||
paths = paths->next;
|
||||
}
|
||||
|
|
|
@ -1294,6 +1294,8 @@ int SHAPE_POLY_SET::NormalizeAreaOutlines()
|
|||
BooleanSubtract( holesBuffer, SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
|
||||
}
|
||||
|
||||
// In degenerate cases, simplify might return no outlines
|
||||
if( OutlineCount() > 0 )
|
||||
RemoveNullSegments();
|
||||
|
||||
return OutlineCount();
|
||||
|
|
Loading…
Reference in New Issue