Boost
C++ Libraries
...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
This is an older version of Boost and was released in 2024. The current version is 1.89.0.
Let the buffer create rounded ends.
This strategy can be used as EndStrategy for the buffer algorithm. It creates a rounded end for each linestring-end. It can be applied for (multi)linestrings. Also it is applicable for spikes in (multi)polygons. This strategy is only applicable for Cartesian coordinate systems.
class strategy::buffer::end_round { // ... };
|
Function |
Description |
Parameters |
|---|---|---|
|
end_round(std::size_t points_per_circle = default_points_per_circle)
|
Constructs the strategy. |
std::size_t: points_per_circle: Number of points (minimum 4) that would be used for a full circle |
#include <boost/geometry/strategies/cartesian/buffer_end_round.hpp>
Shows how the end_round strategy can be used as a EndStrategy to create rounded ends
#include <boost/geometry.hpp> #include <boost/geometry/geometries/point_xy.hpp> #include <boost/geometry/geometries/geometries.hpp> int main() { typedef boost::geometry::model::d2::point_xy<double> point; typedef boost::geometry::model::linestring<point> linestring; typedef boost::geometry::model::polygon<point> polygon; // Declare the round-end strategy with 36 points for a full circle boost::geometry::strategy::buffer::end_round end_strategy(36); // Declare other strategies boost::geometry::strategy::buffer::distance_symmetric<double> distance_strategy(1.0); boost::geometry::strategy::buffer::side_straight side_strategy; boost::geometry::strategy::buffer::join_round join_strategy; boost::geometry::strategy::buffer::point_circle point_strategy; // Declare/fill a multi linestring boost::geometry::model::multi_linestring<linestring> ml; boost::geometry::read_wkt("MULTILINESTRING((3 5,5 10,7 5),(7 7,11 10,15 7,19 10))", ml); // Create the buffered geometry with rounded ends boost::geometry::model::multi_polygon<polygon> result; boost::geometry::buffer(ml, result, distance_strategy, side_strategy, join_strategy, end_strategy, point_strategy); return 0; }