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 2022. The current version is 1.89.0.
Let the buffer create rounded corners.
This strategy can be used as JoinStrategy for the buffer algorithm. It creates a rounded corners around each convex vertex. It can be applied for (multi)linestrings and (multi)polygons. This strategy is only applicable for Cartesian coordinate systems.
class strategy::buffer::join_round { // ... };
|
Function |
Description |
Parameters |
|---|---|---|
|
join_round(std::size_t points_per_circle = 90)
|
Constructs the strategy. |
std::size_t: points_per_circle: points which would be used for a full circle |
#include <boost/geometry/strategies/cartesian/buffer_join_round.hpp>
Shows how the join_round strategy can be used as a JoinStrategy to create rounded corners
#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::polygon<point> polygon; // Declare the join_round strategy with 72 points for a full circle boost::geometry::strategy::buffer::join_round join_strategy(72); // Declare other strategies boost::geometry::strategy::buffer::distance_symmetric<double> distance_strategy(1.0); boost::geometry::strategy::buffer::end_flat end_strategy; boost::geometry::strategy::buffer::side_straight side_strategy; boost::geometry::strategy::buffer::point_circle point_strategy; // Declare/fill a multi polygon boost::geometry::model::multi_polygon<polygon> mp; boost::geometry::read_wkt("MULTIPOLYGON(((5 5,7 8,9 5,5 5)),((8 7,8 10,11 10,11 7,8 7)))", mp); // Create the buffered geometry with rounded corners boost::geometry::model::multi_polygon<polygon> result; boost::geometry::buffer(mp, result, distance_strategy, side_strategy, join_strategy, end_strategy, point_strategy); return 0; }