MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / subtract_retain_largest

Function subtract_retain_largest

src/svgfill/src/arrange_polygons.cpp:148–166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

146
147template <typename T>
148boost::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
168Polygon_2 circ_to_poly(typename Arrangement_2::Ccb_halfedge_const_circulator circ)
169{

Callers 1

eliminate_overlapsFunction · 0.85

Calls 4

beginMethod · 0.45
endMethod · 0.45
areaMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected