I know it is possible to add/subtract different polygons to/from each other via boost::geometry, examples can be found at different places in web. Now what I want to do is something different:
I have a 2D polygon which I want to expand/shrink by a given size. So I'm not talking about a simple scaling-operation but about a function, which calculates a new polygon out of the input data:
in case of the expanding function new coordinate points have to be added at the corners of the input polygon resulting e.g. in a rounded or flat corner at this position
in case of the shrinking function vectors of the input polygon have to be removed completely wherever they are too small to "survive" the shrinking operation
My question: is such an operation possible with boost::geometry? If yes, how can this be done?
Thanks!
This feature is called "Buffering" in the OGC Simple Feature Specification.
Boost Geometry supports it for most 2D cartesian geometries (and you can easily do the rest by conversion), and points only in other coordinate systems.
Documentation
The available strategies:
Here's the sample code
Live On Coliru
Points can "grow together" like this
The linestring example with round corners: