Boost logo

Geometry :

Subject: Re: [geometry] [Spatial Index] bug & question
From: Adam Wulkiewicz (adam.wulkiewicz_at_[hidden])
Date: 2013-06-16 17:18:15


TONGARI wrote:
> I just started to play with Spatial Index, and quickly found a bug in
> "index/detail/rtree/visitors/spatial_query.hpp" line 62
> out_iter = *it; // wrong!
> *out_iter = *it; // ok

Thanks, it's fixed.

Barend, with this, using iterators other than back inserters as output
iterator was not possible. Well, spatial query is probably not a good
place to use other iterators since the number of returned elements is
unknown. Should we merge this with the release branch? I'm always using
back inserters in docs so it should be ok to release it, but this is a bug.

> And my question is: is there a way to query the points within a distance
> from a certain point?
> For example, there are many circles which all have radius r, scattering
> in the space, and given a position, how could I determine which circle
> it's in?
> ...the nearest predicate doesn't have a distance limit, and I don't want
> to recompute the distance, any idea?

The nearest() predicate returns N values nearest to some point. You on
the other hand would like to get all of them.

I assume that you use points as indexables?

You could try using nsphere (currently in extensions) as a parameter of
bgi::intersects() predicate. To work it would require working:

bg::intersects(box, nsphere)

and if you use points

bg::intersects(point, nsphere)

Unfortunately it doesn't compile, but I'll add those operations today
(for cartesian cs).

Alternatively you could use bounding box of this circle of interest if
you don't mind returning more distant points.


Geometry list run by mateusz at