<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.&nbsp; 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.&nbsp; It adjusts the bounds as it goes via the return value (true or false - in response to the question &quot;did the visitor just visit a point that is closer to the target&quot;).<br>
<br>If the visitor always returns false, it&#39;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&#39;ll end up visiting ALL of the points that are distance away == nearest distance.&nbsp; and it&#39;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?&nbsp; thats how I would approach the problem<br><br>Paul<br><br><div class="gmail_quote">2008/10/16 Sylvain Bougerel <span dir="ltr">&lt;<a href="mailto:sylvain.bougerel.devel@gmail.com">sylvain.bougerel.devel@gmail.com</a>&gt;</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&#39;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 &lt;<a href="mailto:w.richert@gmx.net">w.richert@gmx.net</a>&gt; wrote:<br>
&gt; Hi,<br>
&gt;<br>
&gt; in some situations the same point is inserted with different labels. In this<br>
&gt; case find_nearest returns an arbitrary point of these euqally nearest points<br>
&gt; to the query point.<br>
&gt;<br>
&gt; However, it would be nice if one could get either all the points that are<br>
&gt; nearest and identical or to have a method that returns the label of the<br>
&gt; majority of the (identical) nearest points.<br>
&gt;<br>
&gt; Would that be feasible with the current libkdtree++ implementation?<br>
&gt;<br>
&gt; Regards,<br>
&gt;<br>
&gt; wr<br>
&gt;<br>
</div></div>&gt; _______________________________________________<br>
&gt; libkdtree-devel mailing list<br>
&gt; <a href="mailto:libkdtree-devel@lists.alioth.debian.org">libkdtree-devel@lists.alioth.debian.org</a><br>
&gt; <a href="http://lists.alioth.debian.org/mailman/listinfo/libkdtree-devel" target="_blank">http://lists.alioth.debian.org/mailman/listinfo/libkdtree-devel</a><br>
&gt;<br>
&gt;<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>