| Home | Libraries | People | FAQ | More

#### strategy::buffer::point_square

Create a squared form buffer around a point.

###### Description

This strategy can be used as PointStrategy for the buffer algorithm. It creates a square from each point, where the point lies in the center. 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_square
    {
      // ...
    };

###### Header

`#include <boost/geometry/strategies/cartesian/buffer_point_square.hpp>`

###### Example

Shows how the point_square strategy can be used as a PointStrategy to create square buffers where the original point lies in the center

    #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_square strategy
        boost::geometry::strategy::buffer::point_square point_strategy;

        // Declare other strategies
        boost::geometry::strategy::buffer::distance_symmetric<double> distance_strategy(0.5);
        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

###### See also

- buffer (with strategies)
- point_circle
- geographic_point_circle