Skip to content

Commit

Permalink
Clean up some invalid operator combinations.
Browse files Browse the repository at this point in the history
  • Loading branch information
eyal0 committed Feb 3, 2021
1 parent 591322c commit 7468f15
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
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

0 comments on commit 7468f15

Please sign in to comment.