boostorg / boostorg/geometry

Distance strategy for negative buffer

Open
#362 0 comments 0 reactions 1 assignee Claimed by @barendgehrels View on GitHub
Dominant language
C++
Stars
517
Forks
232
PR merge metrics
No merged PRs in 30d

Description

Hi there!
I am making some tests to understand what is going on with the distance strategy when this distance is negative. Using the code below, I got empty MultiPolygons for some values of the buffer. This case only appears with the polygon imported from the given WKT for a buffer of -1e-4, -1e-5 or -1e-6. But it is not empty for -1e-7 and -1e-8. In the self-intersecting case (hourglass), I get weird results (as expected) but not empty MultiPolygons. In the simple case (sqaure), I get proper results whatever the distance of the buffer is.
Is it a bug ? If it is not, could someone explain me why please?
I am using Boost 1.60.
Thank you very much.

```
#include
#include
#include
#include
#include

typedef boost::geometry::model::d2::point_xy point_2d;
typedef boost::geometry::model::polygon polygon_2d;
typedef boost::geometry::model::multi_polygon multi_polygon_2d;

template
void test_buffer(T &geom)
{
for (double i = -1; i < -1e-8; i/=10)
{
multi_polygon_2d tmp;
boost::geometry::buffer(
geom,
tmp,
boost::geometry::strategy::buffer::distance_symmetric(i),
boost::geometry::strategy::buffer::side_straight(),
boost::geometry::strategy::buffer::join_round(),
boost::geometry::strategy::buffer::end_round(),
boost::geometry::strategy::buffer::point_circle(360)
);
std::cout<<"geom ("<

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.