0
votes

I'm having instance of boost::geometry::index::rtree of axis aligned boxes in three dimensions. I'm already using point intersection in 1.54 version of the boost. Works like charm. Well, I'd like also to query for intersection with line (ray, section), which seems to be supported by boost 1.59 (err, with some glitches, but still pretty impressive). Unfortunately as I've said I'm on the version 1.54. and I don't have any chance to change it for now. So the question is: How to extend geometry in boost 1.54. so it supports section intersections with bounding boxes within rtree? What templates do I have to specialize? Is there anything else I have to do? Ideas? thb

1
see highly related: stackoverflow.com/questions/32457920/…; there's a start of a discussion on the boost mailing list linked. Maybe you can weigh in - sehe
Weigh in? If you refer to "some glitches" I mentioned wrt boost 1.59. section intersection, it is likely I've recognized the root of the problem, however I don't see the clear way to fix it. Making it generic for all the thinkable dimensions it would require some sort of template magic I'm not able to wrap my head around. The problem as I see it resides in algorithms\segment_intersection.hpp ::box_segment_intersection::apply. I think, that it can't be decomposed into dimensions in this simple way. But as usually - maybe I'm not right... - thb
BTW, I would also need a "plane" intersection. Well, once I have figured out the segment intersection, it would be just an analogy. - thb
I also forget to mention words "please" and "Hi" in my question. I apologize... - thb
First off greetings and thanks are discouraged as noise. For the rest, you're looking to extend the library. Get on the mailing list. @AdamWulkiewicz is sometimes here, but that's not as good as on the list. - sehe

1 Answers

0
votes

If you pass bgi::intersects() predicate into the query the rtree internally calls bg::intersects() which calls bg::disjoint(). And those spatial relation checks are tested for QueryGeometry/Box and QueryGeometry/Indexable. E.g. if you're storing Boxes then the rtree internally calls bg::intersects(Box, QueryGeometry).

If the QueryGeometry type was adapted to one of the Boost.Geometry concepts, e.g. Segment, but the function was simply not implemented in a version of Boost you're using, you could see how an algorithm is implemented for a combination of concepts in the latest version of Boost. E.g. disjoint(Box, Segment) is implemented here: https://github.com/boostorg/geometry/blob/master/include/boost/geometry/algorithms/detail/disjoint/segment_box.hpp. Then you could probably find the corresponding place in Boost 1.54 and put this code there. Though AFAIR the directories and files structure was altered since 1.54. I guess you could also try to use the whole 1.59 Boost.Geometry code with Boost 1.54 though of course it's not guaranteed that it will work. And as @sehe pointed out in the comments there is an error in disjoint/intersects for Box/Segment combination in 1.59.

If the QueryGeometry was not the kind of a geometry supported by the library, which is AFAIU your case, e.g. Frustum, Cone, Plane, Ray, etc. you could simply overload bg::intersects() or bg::disjoint() for the combination of types the rtree would like to call, in this case for your QueryGeometry and Box. See this for more information: Boost Geometry/Spatial Query Shapes