Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CURA-12061] Remove early-out: Restore 'side-effects' of unioning with empty. #2124

Merged
merged 2 commits into from
Jul 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading