boost-polygon

Shrink/Expand the outline of a polygon with holes

橙三吉。 提交于 2021-01-28 09:20:22
问题 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<int> inPoly where inPoly contains data that describe a rectangular outline and a triangle which forms the hole within this rectangle (in picture below this is the left, black drawing). Now I want to a) expand the whole stuff so that the rectangle becomes bigger and the hole becomes smaller (resulting in the red polygon in image

How to triangulate polygons in Boost?

允我心安 提交于 2019-12-20 21:21:38
问题 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 per cell-edge) Iterate over all created edges to create triangles (not trivial) Any better solution? Edit: I just realized that it is probably possible to walk through the cells in a special way to create the triangles directly (3 neighbor cells

What is the utility of Boost Polygon?

旧城冷巷雨未停 提交于 2019-12-20 19:39:32
问题 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 Boost 1.58 I though I would give a try to Boost Polygon. After trying to understand the library and not getting the expected results I discovered that the library only works for integer coordinates. At first I though that this was a limitation for

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

梦想的初衷 提交于 2019-12-07 10:42:22
问题 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 are non integral I found many incorrect triangulations with missing edges or wrong edges. For example this image has been build with rounded value and is correct (see code below) But this image as been build with raw values and is incorrect (see

Finding out if a point is inside a voronoi cell

旧时模样 提交于 2019-12-06 02:13:01
问题 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<int> p1(0, 0); point_data<int> p2(-10, 10); point_data<int> p3(-10, -10); point_data<int> p4(10, -10); point_data<int> p5(10, 10); std::vector<point_data<int>> pts = { p1, p2, p3, p4, p5 }; construct_voronoi(pts.begin(), pts.end(), vd); In this case, how can I found out if the point (5,5) is inside the

Finding out if a point is inside a voronoi cell

白昼怎懂夜的黑 提交于 2019-12-04 07:53:11
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<int> p1(0, 0); point_data<int> p2(-10, 10); point_data<int> p3(-10, -10); point_data<int> p4(10, -10); point_data<int> p5(10, 10); std::vector<point_data<int>> pts = { p1, p2, p3, p4, p5 }; construct_voronoi(pts.begin(), pts.end(), vd); In this case, how can I found out if the point (5,5) is inside the central cell? I could create a polygon out of each cell and find out using a point in polygon algorithm ,

How to triangulate polygons in Boost?

我们两清 提交于 2019-12-03 06:44:58
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 per cell-edge) Iterate over all created edges to create triangles (not trivial) Any better solution? Edit: I just realized that it is probably possible to walk through the cells in a special way to create the triangles directly (3 neighbor cells create a triangle). Giovanni Funchal The main idea is to iterate through the Voronoi vertices, and

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

喜欢而已 提交于 2019-11-29 09:48:46
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 std::minmax function. To compare, I also declare a second variable where the types are explicitly declared (i.e., dim vs dim1). namespace gtl = boost::polygon; typedef gtl::polygon_90_data<int> LayoutPolygon; typedef gtl::rectangle_data<int> LayoutRectangle; static LayoutFeatureVec calc_stats(LayoutPolygonSet const& lp) { LayoutFeatureVec v;

segmentation-fault with boost::polygon

我怕爱的太早我们不能终老 提交于 2019-11-28 08:48:45
问题 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 <iostream> #include <boost/polygon/polygon.hpp> using namespace boost::polygon::operators; using namespace std; typedef boost::polygon::polygon_data<double> BPolygon; typedef boost::polygon::polygon_traits<BPolygon>::point_type BPoint; typedef boost::polygon::polygon_set

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

自古美人都是妖i 提交于 2019-11-28 03:11:30
问题 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 std::minmax function. To compare, I also declare a second variable where the types are explicitly declared (i.e., dim vs dim1). namespace gtl = boost::polygon; typedef gtl::polygon_90_data<int> LayoutPolygon; typedef gtl::rectangle_data<int>