diff --git a/src/geometry/Shape.cpp b/src/geometry/Shape.cpp index ed5dffbbf0..61d029c4e2 100644 --- a/src/geometry/Shape.cpp +++ b/src/geometry/Shape.cpp @@ -181,14 +181,7 @@ Shape Shape::unionPolygons(const Shape& other, ClipperLib::PolyFillType fill_typ { return {}; } - if (empty() && other.size() <= 1) - { - return other; - } - if (other.empty() && size() <= 1) - { - return *this; - } + // No further early outs, as shapes should be able to be 'unioned' with themselves, which will resolve certain issues like self-overlapping polygons. ClipperLib::Paths ret; ClipperLib::Clipper clipper(clipper_init); addPaths(clipper, ClipperLib::ptSubject); @@ -203,14 +196,7 @@ Shape Shape::unionPolygons(const Polygon& polygon, ClipperLib::PolyFillType fill { return {}; } - if (empty()) - { - return Shape(polygon); - } - if (polygon.empty() && size() <= 1) - { - return *this; - } + // No further early outs, as unioning even with another empty polygon has some beneficial side-effects, such as removing self-overlapping polygons. ClipperLib::Paths ret; ClipperLib::Clipper clipper(clipper_init); addPaths(clipper, ClipperLib::ptSubject);