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

Clean up some invalid operator combinations. #529

Merged
merged 1 commit into from
Feb 3, 2021
Merged
Show file tree
Hide file tree
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
11 changes: 3 additions & 8 deletions bg_operators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ bg::model::multi_polygon<polygon_type_t> operator-(

template multi_polygon_type_fp operator-(const multi_polygon_type_fp&, const multi_polygon_type_fp&);

template <> multi_polygon_type_fp operator-(const multi_polygon_type_fp& lhs, const ring_type_fp& rhs) {
multi_polygon_type_fp rhs_mp{polygon_type_fp{rhs}};
return lhs - rhs_mp;
}

template <typename rhs_t>
multi_polygon_type_fp operator-(const box_type_fp& lhs, const rhs_t& rhs) {
auto box_mp = multi_polygon_type_fp();
Expand Down Expand Up @@ -118,10 +113,10 @@ multi_polygon_type_fp operator&(const bg::model::polygon<point_type_t>& lhs,

template multi_polygon_type_fp operator&(polygon_type_fp const&, multi_polygon_type_fp const&);

template <typename polygon_type_t, typename rhs_t>
template <typename polygon_type_t>
bg::model::multi_polygon<polygon_type_t> operator^(
const bg::model::multi_polygon<polygon_type_t>& lhs,
const rhs_t& rhs) {
const bg::model::multi_polygon<polygon_type_t>& rhs) {
if (bg::area(rhs) <= 0) {
return lhs;
}
Expand All @@ -137,7 +132,7 @@ template multi_polygon_type_fp operator^(const multi_polygon_type_fp&, const mul

template <typename polygon_type_t, typename rhs_t>
bg::model::multi_polygon<polygon_type_t> operator+(const bg::model::multi_polygon<polygon_type_t>& lhs,
const rhs_t& rhs) {
const rhs_t& rhs) {
if (bg::area(rhs) <= 0) {
return lhs;
}
Expand Down
4 changes: 2 additions & 2 deletions bg_operators.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ template <typename rhs_t>
multi_linestring_type_fp operator&(const linestring_type_fp& lhs,
const rhs_t& rhs);

template <typename polygon_type_t, typename rhs_t>
template <typename polygon_type_t>
bg::model::multi_polygon<polygon_type_t> operator^(
const bg::model::multi_polygon<polygon_type_t>& lhs,
const rhs_t& rhs);
const bg::model::multi_polygon<polygon_type_t>& rhs);

template <typename polygon_type_t, typename rhs_t>
bg::model::multi_polygon<polygon_type_t> operator&(const bg::model::multi_polygon<polygon_type_t>& lhs,
Expand Down
2 changes: 1 addition & 1 deletion gerberimporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ multi_polygon_type_fp simplify_cutins(const ring_type_fp& ring) {
if (this_area * area < 0) {
auto correct_r = r;
bg::correct(correct_r);
ret = ret - correct_r;
ret = ret - multi_polygon_type_fp{{correct_r}};
}
}
return ret;
Expand Down