| 1459 | } |
| 1460 | |
| 1461 | std::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 | |
| 1493 | boost::optional<std::vector<Point3d>> buffer(const std::vector<Point3d>& polygon1, double amount, double tol) { |
| 1494 | std::vector<Point3d> allPoints; |
nothing calls this directly
no test coverage detected