boost-geometry

boost geometry polygon distance for inside point

不打扰是莪最后的温柔 提交于 2019-12-11 06:56:35
问题 I am using boost::geometry to handle some geometrical tasks. I have two requirements that I need to cover: Handle point -> polygon intersection (inside or not). This works great with boost::geometry::within so thats good Get the distance of an arbitrary point to the closest edge of the polygon. While points outside of the polygon are handled correctly by boost::geometry::distance , however it seems that it considers polygons solid. So every point inside the polygon obviously has a distance of

Boost::geometry : calculation of the centroid of a polygon

我只是一个虾纸丫 提交于 2019-12-11 06:16:04
问题 I've been working with the Boost geometry, mostly for manipulating polygons; I was using the centroid built-in method (http://www.boost.org/doc/libs/1_55_0/libs/geometry/doc/html/geometry/reference/algorithms/centroid/centroid_2.html) for calculating the geometric (bary) center of my polygons, but recently after outputting the coordinates of my points (composing a specific polygon) (and analyzing them on the side with some Python scripts) I realized that the centroid coordinates the previous

Is it me or part of Boost Track SVN (Boost Geometry Extension Dissolve) is uncompilable?

最后都变了- 提交于 2019-12-11 05:14:53
问题 Boost geometry's dissolve described a bit here, is what I need right now, its SVN home is here but as soon as I include #include <boost/geometry/extensions/algorithms/dissolve.hpp> I get compile errors (error C4430, C2146 and C2061)=( Can any one provide a patch? Sample code can be found for example here Errors: Error 2 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\users\avesta\desktop\cf\trunk\cloudserver\3rdparty\header-only\boost\geometry

Negative buffer of Boost::geometry::multi_polygon

半城伤御伤魂 提交于 2019-12-11 04:15:18
问题 I try to apply a negative buffer to a multipolygon using Boost::geometry. When I run the code below, I get the proper result. But if I remove the marked block, which just export and re-import the geometry in WKT, I get an empty MultiPolygon in the tmp_erosion geometry. I tried to use the boost::geometry::correct() function but it does not change anything. Do you have any idea on how to fix that? Also, I tried to export the geometries to WKB and it is different before and after the export-then

How do I compare Boost Geometries?

試著忘記壹切 提交于 2019-12-11 03:52:30
问题 I have 2 of these boost::geometry::model::ring and I am trying to tell if they are the same. Is there a built in boost geometry compare function/method that can figure this out for me? 回答1: boost::geometry::equals(a,b) reports if two geometries are spatially equal 来源: https://stackoverflow.com/questions/9281336/how-do-i-compare-boost-geometries

Can I use Boost.Geometry.index.rtree with threads?

若如初见. 提交于 2019-12-11 02:53:59
问题 I am trying to create a multithreaded spatial index using rtree from Boost.Geometry, however I am unable to determine if this is thread safe. I do not see any locking mechanisms inside rtree.hpp, but my C++/Boost knowledge is at a beginners level. Is Boost.Geometry.index.rtree thread safe in any way? If not, what would be the optimal approach to use it with multiple threads in a safe manner (e.g. mutex lock between insert() calls? Am I able to query() at the same time as insert()?).

boost rtree of box gives wrong intersection with segment

▼魔方 西西 提交于 2019-12-10 10:45:57
问题 Boost rtree gives wrong intersection result for some intersection with segment queries. In this case the bounding box is a y-planar 10x10 square at y=0. I'm querying with a z-aligned line from (2, 1, 0) to (2, 1, 10). What's interesting is that if I use a box for query instead of a segment then it works as expected. This behavior is also present when the box is not planar, just move the min corner to (0, -5, 0) and it still happens. Am I using this wrong or is it a bug in boost? Edit: have

Boost Polygon Serialization

喜夏-厌秋 提交于 2019-12-07 11:28:44
问题 I am using boost geometry in my project, and I need to serialize polygons. I have been using boost serialization without problems for many boost data types, but boost geometry seems that currently does not support serialization, as I cannot find any header inside serialization folder. Is there any well known method to achieve this? Thanks. EDIT: Binary Serialization Example in: Boost Polygon Serialization: Ring 回答1: I agree, it is weird that Boost.Geometry does not support Boost.Serialization

How to create a Boost.Range that hides multiple layers of vectors and exposes it as a single Range?

醉酒当歌 提交于 2019-12-07 10:08:37
问题 I have a legacy class hierarchy which I can not modify. Because of requirements of an external library, I need to define Boost.Ranges for the Line and Ring, where both only expose the points in a single run (i.e. it should, both for Line and Ring, be a Boost.Range of Points). Pseudo-code to illustrate: Line l1 = Line{{1.0,2.0},{3.0,4.0},{5.0,6.0}} // init Line with three Points Line l2 = Line{{7.0,8.0},{9.0,10.0},{11.0,12.0}} // init Line with three Points auto lit = boost::begin(l1); //

Using boost geometry to check if two lines have an intersection

心不动则不痛 提交于 2019-12-07 04:08:31
问题 Is it possible to use boost::geometry to check whether two line segments (each given by two points in 2D) intersect each other? If this is possible, does boost::geometry allow to check also for special cases such as that only one point is (numerically) on the other line, or that both lines are equal? 回答1: If you are talking specifically about Boost.Geometry API to it is, of course, possible. Your code should look roughly like this #include <boost/geometry/geometries/segment.hpp> #include