Fixed regression: rectilinear infill crashed with zero-area polygons. #3648

This commit is contained in:
Alessandro Ranellucci 2017-03-06 16:32:14 +01:00
parent 7355d39584
commit fc7e022003

View File

@ -1,3 +1,4 @@
#undef NDEBUG
#include "../ClipperUtils.hpp"
#include "../ExPolygon.hpp"
#include "../PolylineCollection.hpp"
@ -28,6 +29,9 @@ FillRectilinear::_fill_single_direction(ExPolygon expolygon,
// We ignore this->bounding_box because it doesn't matter; we're doing align_to_grid below.
BoundingBox bounding_box = expolygon.contour.bounding_box();
// Ignore too small expolygons.
if (bounding_box.size().x < min_spacing) return;
// Due to integer rounding, rotated polygons might not preserve verticality
// (i.e. when rotating by PI/2 two points having the same x coordinate
// they might get different y coordinates), thus the first line will be skipped.