MCPcopy Create free account
hub / github.com/NatLabRockies/OpenStudio / bufferAll

Function bufferAll

src/utilities/geometry/Intersection.cpp:1461–1491  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1459}
1460
1461std::vector<Polygon3d> bufferAll(const std::vector<Polygon3d>& polygons, double tol) {
1462 BoostMultiPolygon source;
1463 std::vector<Point3d> allPoints;
1464
1465 for (const Polygon3d& polygon : polygons) {
1466 boost::optional<BoostPolygon> boostPolygon = BoostPolygonFromPolygon(polygon, allPoints, tol);
1467 source.push_back(*boostPolygon);
1468 }
1469
1470 const boost::geometry::strategy::buffer::distance_symmetric<coordinate_type> expand(tol * scaleBy);
1471 const boost::geometry::strategy::buffer::distance_symmetric<coordinate_type> shrink(-tol * scaleBy);
1472 const boost::geometry::strategy::buffer::join_miter join_strategy;
1473 const boost::geometry::strategy::buffer::end_flat end_strategy;
1474 const boost::geometry::strategy::buffer::side_straight side_strategy;
1475 const boost::geometry::strategy::buffer::point_circle point_strategy;
1476
1477 BoostMultiPolygon resultExpand;
1478 BoostMultiPolygon resultShrink;
1479 boost::geometry::buffer(source, resultExpand, expand, side_strategy, join_strategy, end_strategy, point_strategy);
1480 boost::geometry::buffer(resultExpand, resultShrink, shrink, side_strategy, join_strategy, end_strategy, point_strategy);
1481
1482 std::vector<Polygon3d> result;
1483 result.reserve(resultShrink.size());
1484 for (const auto& boostPolygon : resultShrink) {
1485 BoostPolygon simplified;
1486 boost::geometry::simplify(boostPolygon, simplified, tol);
1487 result.push_back(PolygonFromBoostPolygon(simplified, allPoints, tol));
1488 }
1489
1490 return result;
1491}
1492
1493boost::optional<std::vector<Point3d>> buffer(const std::vector<Point3d>& polygon1, double amount, double tol) {
1494 std::vector<Point3d> allPoints;

Callers

nothing calls this directly

Calls 6

BoostPolygonFromPolygonFunction · 0.85
bufferFunction · 0.85
simplifyFunction · 0.85
PolygonFromBoostPolygonFunction · 0.85
push_backMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected