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 the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

strategy::buffer::point_circle

Create a circular buffer around a point.

Description

This strategy can be used as PointStrategy for the buffer algorithm. It creates a circular buffer around a point. It can be applied for points and multi_points, but also for a linestring (if it is degenerate, so consisting of only one point) and for polygons (if it is degenerate). This strategy is only applicable for Cartesian coordinate systems.

Synopsis

class strategy::buffer::point_circle
{
  // ...
};

Constructor(s)

Function

Description

Parameters

point_circle(std::size_t count = 90)

Constructs the strategy.

std::size_t: count: number of points for the created circle (if count is smaller than 3, count is internally set to 3)

Header

#include <boost/geometry/strategies/cartesian/buffer_point_circle.hpp>

Example

Shows how the point_circle strategy can be used as a PointStrategy to create circular buffers around points

#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 point_circle strategy
    boost::geometry::strategy::buffer::point_circle point_strategy(360);

    // Declare other strategies
    boost::geometry::strategy::buffer::distance_symmetric<double> distance_strategy(0.7);
    boost::geometry::strategy::buffer::join_round join_strategy;
    boost::geometry::strategy::buffer::end_round end_strategy;
    boost::geometry::strategy::buffer::side_straight side_strategy;

    // Declare/fill of a multi point
    boost::geometry::model::multi_point<point> mp;
    boost::geometry::read_wkt("MULTIPOINT((3 3),(3 4),(4 4),(7 3))", mp);

    // Create the buffer of a multi point
    boost::geometry::model::multi_polygon<polygon> result;
    boost::geometry::buffer(mp, result,
                distance_strategy, side_strategy,
                join_strategy, end_strategy, point_strategy);


    return 0;
}

Output

buffer_point_circle

See also

PrevUpHomeNext