Boost logo

Geometry :

Subject: Re: [geometry] R-tree segment query optimization
From: Jeremy Murphy (jeremy.william.murphy_at_[hidden])
Date: 2018-04-17 04:31:43


Hi Adam,

On 17 April 2018 at 02:49, Adam Wulkiewicz via Geometry <
geometry_at_[hidden]> wrote:

> Hi Jeremy,
>
> Jeremy Murphy wrote:
>
> Hi Adam,
>
> thanks for the detailed answer. I haven't used Boost.Geometry rtree in a
> while, so I'm stuck already. :\
> I created an rtree of 2D Cartesian points, that's fine. But when I tried
> to do a query using a nearest(segment, 1) predicate, I get a compilation
> error that looks like comparable_distance is not-yet-implemented between
> SEGMENT and BOX.
>
> It is supported. It's hard to tell what may be the problem in your case
> without the code. The following code compiles and runs correctly for me:
>
> #include <boost/geometry.hpp>
> #include <boost/geometry/index/rtree.hpp>
>
>
OK, as I suspected, it's a matter of including the right headers.
This is what I had:

#include <boost/geometry/geometries/point.hpp>
#include <boost/geometry/geometries/segment.hpp>
#include <boost/geometry/strategies/strategies.hpp>
#include <boost/geometry/index/rtree.hpp>

And I got it to compile by adding one more header:
<boost/geometry/algorithms/comparable_distance.hpp>
(I thought I tried this before posting, but, evidently not.)

My feeling is that whatever dependency is provided by that header should
probably be included automatically with rtree, but on looking back through
the documentation I can see that you do recommend

#include <boost/geometry.hpp>

so I guess I just need to get used to that practice.
Thanks for your patience with my regressing back to teething problems!
Cheers.

Jeremy



Geometry list run by mateusz at loskot.net