| 146 | |
| 147 | template <typename T> |
| 148 | boost::optional<Polygon_2> subtract_retain_largest(const T& lhs, const T& rhs) { |
| 149 | std::vector<Polygon_with_holes_2> result; |
| 150 | boost::optional<Polygon_2> mp; |
| 151 | |
| 152 | CGAL::difference(lhs, rhs, std::back_inserter(result)); |
| 153 | |
| 154 | std::sort(result.begin(), result.end(), [](const Polygon_with_holes_2& a, const Polygon_with_holes_2& b) { |
| 155 | return a.outer_boundary().area() < b.outer_boundary().area(); |
| 156 | }); |
| 157 | |
| 158 | if (result.size() > 0) { |
| 159 | if (result.front().has_holes()) { |
| 160 | return boost::none; |
| 161 | } |
| 162 | return result.front().outer_boundary(); |
| 163 | } |
| 164 | |
| 165 | return boost::none; |
| 166 | } |
| 167 | |
| 168 | Polygon_2 circ_to_poly(typename Arrangement_2::Ccb_halfedge_const_circulator circ) |
| 169 | { |
no test coverage detected