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 version of Boost is under active development. You are currently in the develop branch. The current version is 1.90.0.
Let the buffer algorithm create buffers with same distances.
template<typename NumericType> class strategy::buffer::distance_symmetric { // ... };
|
Parameter |
Description |
|---|---|
|
typename NumericType |
numerical type (int, double, ttmath, ...) |
|
Function |
Description |
Parameters |
|---|---|---|
|
distance_symmetric(NumericType const & distance)
|
Constructs the strategy, a distance must be specified. |
NumericType const &: distance: The distance (or radius) of the buffer |
#include <boost/geometry/strategies/agnostic/buffer_distance_symmetric.hpp>
Shows how the distance_symmetric strategy can be used as a DistanceStrategy to create symmetric buffers
#include <boost/geometry.hpp> #include <boost/geometry/geometries/point_xy.hpp> #include <boost/geometry/geometries/geometries.hpp> int main() { using point = boost::geometry::model::d2::point_xy<double>; using linestring = boost::geometry::model::linestring<point>; using polygon = boost::geometry::model::polygon<point>; // Declare the symmetric distance strategy boost::geometry::strategy::buffer::distance_symmetric<double> distance_strategy(0.5); // Declare other strategies boost::geometry::strategy::buffer::side_straight side_strategy; boost::geometry::strategy::buffer::join_round join_strategy; boost::geometry::strategy::buffer::end_round end_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 left/right the same distance boost::geometry::model::multi_polygon<polygon> result; boost::geometry::buffer(ml, result, distance_strategy, side_strategy, join_strategy, end_strategy, point_strategy); return 0; }