<div dir="ltr">Hi Will, Sylvain,<br><br>I am not so sure that we can generate an iterator just like that, because two nodes that are close to a point may be on two sides of the tree - if the target is right on a dividing line (hope thats not too vague to get the picture).<br>
<br>I think I emailed the list a while back in response to a query about getting the last 4 closest points via find_nearest_if or visit_nearest. I think the only way may be to approach it from that direction...<br><br>the basic idea is that the visitor is called as the algorithm steps through the tree. It adjusts the bounds as it goes via the return value (true or false - in response to the question "did the visitor just visit a point that is closer to the target").<br>
<br>If the visitor always returns false, it'll end up visiting every node in the tree.<br>If it returns true only for the points that are closer to the target, then it'll end up visiting ALL of the points that are distance away == nearest distance. and it'll also visit the nodes leading up to the discovery of the closest points.<br>
<br>that all may not be perfectly accurate, but do you get the idea? thats how I would approach the problem<br><br>Paul<br><br><div class="gmail_quote">2008/10/16 Sylvain Bougerel <span dir="ltr"><<a href="mailto:sylvain.bougerel.devel@gmail.com">sylvain.bougerel.devel@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi Willi,<br>
<br>
I bumped into the same requirement in the past. My personal desire it<br>
to implement an iterator on the nearest neighbor that goes outward.<br>
With this, you could call i++ until you find the point that correspond<br>
to your requirements. I've just started working on this recently, and<br>
you might have to wait a bit for a similar feature to come in.<br>
<br>
<br>
At the moment, regrettably, I cannot think of any solution that does<br>
not involve modifying the library itself.<br>
<div><div></div><div class="Wj3C7c"><br>
On Wed, Oct 15, 2008 at 7:06 PM, Willi Richert <<a href="mailto:w.richert@gmx.net">w.richert@gmx.net</a>> wrote:<br>
> Hi,<br>
><br>
> in some situations the same point is inserted with different labels. In this<br>
> case find_nearest returns an arbitrary point of these euqally nearest points<br>
> to the query point.<br>
><br>
> However, it would be nice if one could get either all the points that are<br>
> nearest and identical or to have a method that returns the label of the<br>
> majority of the (identical) nearest points.<br>
><br>
> Would that be feasible with the current libkdtree++ implementation?<br>
><br>
> Regards,<br>
><br>
> wr<br>
><br>
</div></div>> _______________________________________________<br>
> libkdtree-devel mailing list<br>
> <a href="mailto:libkdtree-devel@lists.alioth.debian.org">libkdtree-devel@lists.alioth.debian.org</a><br>
> <a href="http://lists.alioth.debian.org/mailman/listinfo/libkdtree-devel" target="_blank">http://lists.alioth.debian.org/mailman/listinfo/libkdtree-devel</a><br>
><br>
><br>
<br>
_______________________________________________<br>
libkdtree-devel mailing list<br>
<a href="mailto:libkdtree-devel@lists.alioth.debian.org">libkdtree-devel@lists.alioth.debian.org</a><br>
<a href="http://lists.alioth.debian.org/mailman/listinfo/libkdtree-devel" target="_blank">http://lists.alioth.debian.org/mailman/listinfo/libkdtree-devel</a><br>
</blockquote></div><br></div>