boost-geometry

ID field intermittently lost in custom point class

℡╲_俬逩灬. 提交于 2019-12-17 16:53:27
问题 I'm building a C++ program which needs to handle geometry. I have been trying to get boost::geometry to work, but I am having the following issue. My points need to maintain an ID value or other identifying tag (I need to link them to properties stored in other objects). I can successfully register this point using BOOST_GEOMETRY_REGISTER_POINT_2D_GET_SET and carry out boost::geometry operations, however the moment I carry out any operations with it boost::geometry seems to create new copies

Boost geometry union with auto-allocation

只愿长相守 提交于 2019-12-13 21:03:47
问题 #include <iostream> #include <boost/geometry.hpp> #include <boost/geometry/geometries/register/point.hpp> #include <boost/shared_ptr.hpp> #include <boost/make_shared.hpp> using namespace boost::geometry; class CustomPoint{ public: double X; double Y; }; using cpPtr = boost::shared_ptr<CustomPoint>; namespace boost { namespace geometry { namespace traits { BOOST_GEOMETRY_DETAIL_SPECIALIZE_POINT_TRAITS(cpPtr, 2, double, cs::cartesian) template<> struct access<cpPtr, 0> { static inline double

Geometry, intersection

只谈情不闲聊 提交于 2019-12-13 07:19:54
问题 I have a problem. I would like to intersect a quad with a quad. int main(){ typedef boost::geometry::model::point_xy<double> TBoostPoint; typedef boost::geometry::model::polygon<TBoostPoint> TBoostPoly; TBoostPoint point; TBoostPoly firstPoly, secondPoly; boost::geometry::read_wkt("POLYGON( (1.504477611940313, 3.761194029850755), (1.504477611940305, 3.573134328358203), (1.316417910447765, 3.573134328358206), (1.316417910447769, 3.761194029850752))", firstPoly); boost::geometry::read_wkt(

Split geometry using Boost Library

倖福魔咒の 提交于 2019-12-13 06:08:59
问题 Is there any way to perform split operation on a geometry using Boost library? 回答1: I'm not sure what do you have in mind exactly but you could check the algorithms implemented in Boost.Geometry (http://www.boost.org/libs/geometry). I'm guessing that you could implement it using intersection() or difference() algorithm. 回答2: You are not specific enough about what is your input and what is your definition of splitting it. Is there any way to perform split operation on a geometry using Boost

Why boost::geometry::intersection does not work correct?

天大地大妈咪最大 提交于 2019-12-12 14:24:26
问题 I wrote next test function for Boost Geometry intersection function typedef boost::geometry::model::polygon<boost::tuple<int, int> > Polygon; void test_boost_intersection() { Polygon green, blue; boost::geometry::read_wkt("POLYGON((0 0,0 9,9 9,9 0,0 0))", green); boost::geometry::read_wkt("POLYGON((2 2,2 9,9 9,9 2,2 2))", blue); std::deque<Polygon> output; boost::geometry::intersection(green, blue, output); BOOST_FOREACH(Polygon const& p, output) { std::cout << boost::geometry::dsv(p) << std:

Boost Polygon Serialization: Ring

自作多情 提交于 2019-12-12 11:33:33
问题 According to this related question (Boost Polygon Serialization). I am trying to serialize polygons with Boost. The problem I have now is that I am trying to compile an example using polygons of custom X, Y, points, but the compiler throws this error at compile time: error: 'class boost::geometry::model::ring<boost::geometry::model::d2::point_xy<double> >' has no member named 'serialize' Like there is no defined any function to serialize a ring. Since a Ring extends from std::vector, and as

Boost Geometry/Spatial Query Shapes

让人想犯罪 __ 提交于 2019-12-12 10:11:24
问题 I am currently using the boost geometry/spatial index library, in order to perform range queries on 3d bounding boxes. For example I am able to get a list of all bounding boxes, that overlap a query bounding box. The documentation (http://www.boost.org/doc/libs/1_54_0_beta1/libs/geometry/doc/html/geometry/spatial_indexes/queries.html) shows, that -- at least in 2d -- polygons can be used instead of the bounding box as a query object. Is it possible to use more advanced query shapes in 3d as

Find all linesegments=edges within a certain distance to a point in a graph, how to combine boost-graph with boost-geometry?

谁都会走 提交于 2019-12-12 04:35:07
问题 I have a set of user paths (2 dim) in a game setup that are modelled as a set of lines (arcs) and waypoints = vertices. The whole set of paths can be seen as a graph where the edges are line segments that have additional properties like length, probability, etc. Now I have to identify the set of (straight) line segments = edges within a certain distance to the user's current position in order to find the user's position in the graph. How to implement this as simply as possible without

Intersection Line Poly boost geometry

纵然是瞬间 提交于 2019-12-12 01:55:01
问题 I want to calculate the intersection point between a line: l := direction * x + origin for x e R or x e [0,R+) and a default Boost polygon. In the documentation I only found the possibility to get the intersection with a line Segment (fixed start and end point) At the moment I am using boost geometry and for intersection : http://www.boost.org/doc/libs/1_57_0/libs/geometry/doc/html/geometry/reference/algorithms/intersection.html Did I miss anything? Or do you know some boost function which I

boost::geometry::difference providing custom point with attributes [duplicate]

爱⌒轻易说出口 提交于 2019-12-11 16:27:43
问题 This question already has answers here : ID field intermittently lost in custom point class (2 answers) Closed last year . I'd like to use 2D points with attributes for the polygons. The attributes should be assigned to any new points according to some kind of strategy. Do you know if it is possible and how to do it? Is there any doc describing how to do it? 回答1: Last time I looked at things it proved impossible. That's because the library does construct new points using the available