Georgios Samaras wrote:If the kNN query using query() function is performed, the order of returned Values isn't specified. The function returns 5 NNs, not sorted 5NNs. This way we save a call of sort() or sort_heap().
I changed the code to use points, but order the items are returned is not understandable by me.
I request the 5 NNs of the query point (0, 0), in a dataset of points (0, 0), (1, 1), .., (9, 9).
The output I receive is this:
knn query result:
POINT(4 4)
POINT(3 3)
POINT(2 2)
POINT(0 0)
POINT(1 1)
If you need the code, let me know. I remember that I read that the order is not specified, but does that mean that there is no logic in the results? I mean, clearly the 1st NN is (0, 0).
AFAIK the most typical use case would be to perform a kNN query and then to process all of those neighbours so it's not needed to sort them prematurely.
On the other hand in the case of query iterators ( http://www.boost.org/doc/libs/1_55_0/libs/geometry/doc/html/geometry/spatial_indexes/queries.html#geometry.spatial_indexes.queries.breaking_or_pausing_the_query )
you should get closer Values first.
Regards,
Adam
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users