Buffer problem and understanding chord error
- Dominant language
- C++
- Stars
- 517
- Forks
- 232
- PR merge metrics
- No merged PRs in 30d
Description
I have a problem with boost::geometry::buffer. Basically I offset/buffer one linestring by a certain value (e.g. 4) using a certain number of points_per_circle (in my case 180). Now, I offset a second linestring, which lies inside or at most on the first linestring. The second linestring is offset by a value smaller than the first
4 - chord_error
and I expected there to be no intersections. However, in (few) cases there are intersection points between the two offsets.
I compute the chord error as
chord_error(npts, radius) = ( 1. - cos( Pi / npts)) * radius
Maybe the problem has to do with my interpretation of **points_per_circle** as I expected to be able to derive from it a smallest number that can be used to guarantee that the second offset lies completely within the first.
Please advice.
The following program demonstrates my problem:
https://wandbox.org/permlink/wvGM3SFlM5MXLx5Z
LineString ls0 (green) lies within or on ls1 (red).

From a large box around ls1 is subtract the buffer of ls1, this yields **remains_of_aabb** (brown).

The buffer of ls0 (blue) now intersects remains_of_aabb, and lies as much as 89.9959-89.9987 = -0.0028 outside.


Thanks in advance
Contributor guide
Assessment
This issue has not been assessed yet.