Subject: Re: [geometry] [Boost-users] how to set number of points / chord length in buffer() join_round strategy?
From: Barend Gehrels (barend_at_[hidden])
Date: 2013-03-02 13:30:26
On 28-2-2013 1:03, John Lilley wrote:
> I see in the released buffer() algorithm, there is a chord length argument:
> void buffer(Input const & geometry_in, Output & geometry_out, Distance const & distance, Distance const & chord_length = -1)
> But I can't seem to find an equivalent for buffer_inserter<> with a join_round strategy. How do I set the chord length or number of approximating points?
It was there but not yet exposed. I did put this in the constructor now.
You can now construct the join_round with the number of points for a
full circle. The default is 100.
Furthermore I also added support for multi_linestring types. Note that
the so-called end-cap of linestring types is not yet supported, they
currently always have square ends. That will be implemented later. What
is (was) already there is the asymmetric distance.
So this (I put all these things together in the sample below) delivers
the following picture. Original line is dotted, buffer is green.
If you decrease the number of points (e.g. 12) even more, you get less
I repeat that the algorithm itself is not released yet, and (w.r.t.
buffering) not enhanced today, I just added multi_linestrings. So there
will be situations where it fails.
typedef boost::geometry::model::d2::point_xy<double> point_type;
typedef boost::geometry::model::linestring<point_type> linestring;
typedef boost::geometry::model::polygon<point_type> polygon;
// Multi Linestring
point_type> join(30); // 30 points per full circle
boost::geometry::read_wkt("MULTILINESTRING((0 0,4 5,7 4,10
6),(1 5,5 9,8 6))", my_input);
std::cout << "Input, #points: " <<
boost::geometry::num_points(my_input) << std::endl;
std::cout << "Output, area: " <<
boost::geometry::area(my_output) << std::endl;
Geometry list run by mateusz at loskot.net