Questions tagged [boost-polygon]

The Boost.Polygon library provides algorithms focused on manipulating planar polygon geometry data.

The BOOST Polygon library uses C++-Concepts inspired template programming to provide generic library functions overloaded on concept type. There are currently thirteen concepts in the Polygon library type system. A concept object in the Polygon library is just an empty struct similar to a tag that would be used for tag dispatching.

The Boost.Polygon library provides algorithms focused on manipulating planar polygon geometry data. Specific algorithms provided are the polygon set operations (intersection, union, difference, disjoint-union) and related algorithms such as polygon connectivity graph extraction, offsetting and map-overlay. An example of the disjoint-union (XOR) of figure a and figure b is shown below in figure c. These so-called Boolean algorithms are of significant interest in GIS (Geospatial Information Systems), VLSI CAD as well all other fields of CAD, and many more application areas, and providing them is the primary focus of this library. The Boost.Polygon library is not intended to cover all of computational geometry in its scope, and provides a set of capabilities for working with coordinates, points, intervals and rectangles that are needed to support implementing and interacting with polygon data structures and algorithms.

More Reference Documentation can be found here

55 questions
13
votes
3 answers

What is the utility of Boost Polygon?

This is a question about Boost Polygon (not about Boost Geometry) Recently I was trying to play with some geometrical polygon constructions. Since Boost Geometry (a different library which also deals with polygons) is not working circumstantially in…
alfC
  • 14,261
  • 4
  • 67
  • 118
12
votes
1 answer

Observing weird behavior with 'auto' and std::minmax

I am using GCC 4.7.2 and Boost 1.58.0 on SUSE Enterprise Linux 11. I have the following code snippet which basically goes through a list of polygons to compute their length/width. I'm seeing strange output when using the 'auto' keyword with the…
user4979733
  • 3,181
  • 4
  • 26
  • 41
9
votes
1 answer

How to triangulate polygons in Boost?

What is the best way to triangulate a polygon with Boost? I use Boost.polygon. My current algorithm: Compute a voronoï diagram from my polygon vertices. Create one directed polygon-edge for each cell-edge (this will create two directed polygon edge…
arthur.sw
  • 11,052
  • 9
  • 47
  • 104
7
votes
1 answer

C++: Get list of simple polygons from polygon with holes

I'm struggling with Boost::Polygon - apparently it can do everything except the thing I want. I have a few boundaries describing set of polygons and their holes (in 2d space). In general we can even have hole in a hole (smaller polygon in hole of a…
Ch3shire
  • 1,095
  • 2
  • 14
  • 39
6
votes
3 answers

How to split a general closed polygon by a line segment

I need a good (robust) algorithm for splitting a polygon into two sets(left/right) by a line segment. My polygon representation is simply a list of integer coordinates(ordered clock wise, never self intersecting) and the line segment is represented…
bgp2000
  • 1,070
  • 13
  • 32
5
votes
3 answers

Delaunay from Voronoi with boost: missing triangle with non-integral point coordinates

Following this two resources: Boost basic tutorial SO Question I wrote a Delaunay triangulation with boost. It works fine if the points coordinates are integral (I generated several random tests and I did not observed error). However if the points…
JRR
  • 3,024
  • 2
  • 13
  • 37
5
votes
3 answers

Finding out if a point is inside a voronoi cell

Is there a simple way to find out if a point is inside a voronoi cell? For example, the following code generates something like the diagram below: using namespace boost::polygon; point_data p1(0, 0); point_data p2(-10,…
André Wagner
  • 1,330
  • 15
  • 26
4
votes
1 answer

Incorrect subtract result using Boost Polygon

I have the following two input polygons for which I want to calculate a subtracted polygon: A: * (0, 8) / \ / \ / \ (-3, 0) *-------* (3, 0) B: (-1, 2) *-----* (1, 2) …
Ton van den Heuvel
  • 10,157
  • 6
  • 43
  • 82
3
votes
1 answer

How to query a Voronoi diagram?

I am using boost to compute the voronoi diagram of a set of points in 2-D, very straightforward; std::vector points; ... voronoi_diagram vd; construct_voronoi(points.begin(), points.end(), &vd); Is there an algorithm to process the…
Vectorizer
  • 1,076
  • 9
  • 24
3
votes
2 answers

Shrink/Expand the outline of a polygon with holes

I want to expand/shrink a polygon with holes using boost::polygon. So to clarify that a bit, I have a single data structure boost::polygon::polygon_with_holes_data inPoly where inPoly contains data that describe a rectangular outline and a…
Elmi
  • 5,899
  • 15
  • 72
  • 143
3
votes
0 answers

Convex partitioning of polygons in boost geometry or polygon

Is it possible to compute a partitioning in convex sub-polygons using boost::geometry or boost::polygon? I have a concave (non-convex) polygon and I would like to transform it into convex sub-polygons. Can boost do that? I am not after an optimal…
arennuit
  • 855
  • 1
  • 7
  • 23
3
votes
0 answers

How to merge a large set of polygons with Boost Polygon?

I am looking for a way, using Boost Polygon, to read in a large set of polygons from a file, and output the resulting merge or union to a result file. In this case the polygons touch but do not overlap. I can put the data in any format. Not sure if…
Richard
  • 31
  • 1
3
votes
0 answers

How to iterate over polygon points (in polygon_set_data) in Boost.polygon?

How can I iterate over the points of a polygon_set_data? It is possible to get the polygons in a polygon_set_data by using void get(output_container& output) const, and then use the result to iterate over the points like in the below example, but…
arthur.sw
  • 11,052
  • 9
  • 47
  • 104
3
votes
1 answer

segmentation-fault with boost::polygon

I have got polygon-data which I processed. Now I want to see how well my processed data fits my original data. For this task I want to use BOOST's polygon set-operators. The following code gives me a segfault though: #include #include…
3
votes
1 answer

Boost polygon discards input polygons

I'm trying to build a set of polygons incrementally using Boost::Polygon. The live dataset in the code below is taken from a pathological input I found in the real-world system I'm using Boost::Polygon for. Here is the minimum reproduction code…
bkconrad
  • 2,620
  • 3
  • 20
  • 30
1
2 3 4