the find_ and visit_ methods either will find the &#39;nearest&#39;, or find &#39;all&#39; in the range...<br>So without writing a new method called something like visit_first_within_range(), you could just throw an exception inside the visitor when you have a satisfactory result.<br>

<br>eg<br><br>struct found_one<br>{<br>   YourInfo info;<br>};<br><br>class Visitor<br>{<br>   etc operator() etc<br>  {<br>    found_one result;  <a href="http://result.info">result.info</a> = whatever;  throw result;<br>

  }<br>}<br><br>then a try, catch block will catch the results.<br><br>Sorry thats a bit messy, but thats one approach.<br><br>Paul<br><br><br><div class="gmail_quote">2009/8/23 Andrew Leung <span dir="ltr">&lt;<a href="mailto:anwleung@gmail.com">anwleung@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,<br>
<br>
I am using libkdtree++ and would like to get a couple of tips on how I can improve my performance.<br>
<br>
In most instances when I query the KD-tree using the visit_within_range() function, I do not need to continue the search once any tree node is found that is within the range. Is there a way to stop the query once a node is found to satisfy the query? The REGION.encloses() call tends to be very expensive and I would like to avoid any needless calls to this function. Is it possible to just &#39;return visitor;&#39; when the REGION.encloses() condition is meet?<br>


<br>
Thanks.<br>
Andrew<br>
<br>
_______________________________________________<br>
libkdtree-devel mailing list<br>
<a href="mailto:libkdtree-devel@lists.alioth.debian.org" target="_blank">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>