Skip to content

Commit

Permalink
[CURA-12061] Remove early-out: Restore 'side-effects' of unioning wit…
Browse files Browse the repository at this point in the history
…h empty. (#2124)
  • Loading branch information
HellAholic authored Jul 31, 2024
2 parents 807eb6a + 078c20a commit 15616b0
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions src/geometry/Shape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit 15616b0

Please sign in to comment.