Buffering linestring on right side creating weird results
- Dominant language
- C++
- Stars
- 517
- Forks
- 232
- PR merge metrics
- No merged PRs in 30d
Description
Hello,
I have a linestring and I am running the buffer function with an asymmetric distance. I want to buffer only on the right side of the linestring LINESTRING(0 0,-3 5,15 7,17 4,14 2)
I am getting unexpected results.
[


](url)
Here is an idea of the code:
```
using coordinate_type = double;
using point = boost::geometry::model::d2::point_xy;
using polygon = boost::geometry::model::polygon;
// Declare strategies
const double buffer_distance = amount;
const int points_per_circle = 36;
boost::geometry::strategy::buffer::distance_symmetric
bg_both_sides_distance_strategy(buffer_distance);
boost::geometry::strategy::buffer::distance_asymmetric
bg_left_side_distance_strategy(buffer_distance, 0.0);
boost::geometry::strategy::buffer::distance_asymmetric
bg_right_side_distance_strategy(0.0, buffer_distance);
boost::geometry::strategy::buffer::join_miter bg_join_miter_strategy;
boost::geometry::strategy::buffer::join_round bg_join_round_strategy(
points_per_circle);
boost::geometry::strategy::buffer::end_round bg_end_round_strategy(
points_per_circle);
boost::geometry::strategy::buffer::end_flat bg_end_flat_strategy;
boost::geometry::strategy::buffer::point_circle bg_circle_strategy(
points_per_circle);
boost::geometry::strategy::buffer::side_straight bg_side_straight_strategy;
// Declare output
boost::geometry::model::multi_polygon result;
// Declare/fill a linestring
boost::geometry::model::linestring ls;
ls.reserve(pts_in.size());
for (const auto& pt : pts_in) {
ls.emplace_back(pt[0], pt[1]);
}
boost::geometry::buffer(ls, result, bg_right_side_distance_strategy,
bg_side_straight_strategy,
bg_join_round_strategy, bg_end_round_strategy,
bg_circle_strategy);
std::cout << "output: " << boost::geometry::wkt(result) << std::endl;
```
Thank you.
Best regards.
Bertrand
Contributor guide
Assessment
This issue has not been assessed yet.