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

Method arrange_polygons

src/svgfill/src/arrange_polygons.cpp:3276–3297  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3274#ifndef SVGFILL_MAIN
3275
3276bool svgfill::arrange_polygons(arrange_polygon_settings settings, const std::vector<svgfill::polygon_2>& polygons, std::vector<svgfill::polygon_2>& arranged) {
3277 std::vector<Polygon_2> cgal_polygons, cgal_polygons_out;
3278 std::transform(polygons.begin(), polygons.end(), std::back_inserter(cgal_polygons), [](auto& poly) {
3279 Polygon_2 result;
3280 std::transform(poly.boundary.begin(), poly.boundary.end(), std::back_inserter(result), [](auto& p) {
3281 return Point_2(p[0], p[1]);
3282 });
3283 return result;
3284 });
3285 arrange_cgal_polygons(settings, cgal_polygons, cgal_polygons_out);
3286 std::transform(cgal_polygons_out.begin(), cgal_polygons_out.end(), std::back_inserter(arranged), [](auto& poly) {
3287 svgfill::polygon_2 result;
3288 std::transform(poly.begin(), poly.end(), std::back_inserter(result.boundary), [](auto& pt) {
3289 return svgfill::point_2{
3290 CGAL::to_double(pt.cartesian(0)),
3291 CGAL::to_double(pt.cartesian(1)),
3292 };
3293 });
3294 return result;
3295 });
3296 return true;
3297}
3298
3299#else
3300

Callers 1

mainFunction · 0.80

Calls 4

arrange_cgal_polygonsFunction · 0.85
to_doubleFunction · 0.50
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected