Question

Related Question:
An algorithm for inflating/deflating (offsetting, buffering) polygons

The difference is that I'm searching for a way to inflate a given polyline into a polygon:

polyline with a box around

I've got the following input:

  • List of 2D Points which form the polyline (bright green in the sketch)
  • Width of the line

The output should be a polygon which shows how the line looks expanded by the width.

I originally thought I could use Boost::Geometry::buffer for that, unfortunately it just seems to support boxes for now. A solution using Boost::Geometry or GDAL/OGR would be preffered.

UPDATE:
I chose to use the Clipper Library and its OffsetPolyLines function. As soon as Boost Geometry is released with Polyline-Buffer support I'll switch to Boost (as everything else runs with Boost in my software).

Was it helpful?

Solution

I understand that the OP was preferring a solution in Boost::Geometry or GDAL/OGR but, in case others are following this thread, my Clipper library can also do polyline offsetting. (The soon to be released version 6 that's already in the SourceForge repository simplifies this and it now supports open path (polyline) clipping too.)

OTHER TIPS

Boost.Geometry extension (from Trunk) can do this. It is not yet released. It can buffer around polygons, polygons, points, and multi-geometries. You can specify sharp corners (miter) or rounded corners. It is not yet perfect, but lines as your sample above should not give any problems.

The released version (1.54) does not have this yet, and also the next one will not have it yet. So for now you have to use the Trunk (from SVN)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top