Hello,<br><br>I used libkdtree (ver 0.7.0) with floating point values and the function find_within_range() to get all values within a specified range. Unfortunately, the accuracy of the results have been poor. I used two set of points. The first one:<br>
<br>x=18.892500 y=20.341400 z=-1.188940<br>x=18.446899 y=18.649700 z=-2.155560<br>x=18.228800 y=16.921600 z=-2.665970<br><br>And the second one:<br><br>x=28.771200 y=16.921600 z=-2.665970<br>x=28.553101 y=18.649700 z=-2.155560<br>
x=28.107500 y=20.341400 z=-1.188940<br><br>If you insert the second set into the kdtree and check all points of the first one with find_within_range(sv, 10.0f, std::back_inserter(vectors)); you get the following result:<br>
<br>info: distance = 10.557716 with :
<p style="margin: 0px; text-indent: 0px; color: rgb(0, 0, 0);">info: x=18.892500 y=20.341400 z=-1.188940</p>
<p style="margin: 0px; text-indent: 0px; color: rgb(0, 0, 0);">Info: x=28.771200 y=16.921600 z=-2.665970</p><p style="margin: 0px; text-indent: 0px; color: rgb(0, 0, 0);"><br></p>
<p style="margin: 0px; text-indent: 0px; color: rgb(0, 0, 0);">Info: distance = 9.855121 with :</p>
<p style="margin: 0px; text-indent: 0px; color: rgb(0, 0, 0);">Info: x=18.892500 y=20.341400 z=-1.188940</p>
<p style="margin: 0px; text-indent: 0px; color: rgb(0, 0, 0);">Info: x=28.553101 y=18.649700 z=-2.155560</p><p style="margin: 0px; text-indent: 0px; color: rgb(0, 0, 0);"><br></p>
<p style="margin: 0px; text-indent: 0px; color: rgb(0, 0, 0);">Info: distance = 9.215000 with :</p>
<p style="margin: 0px; text-indent: 0px; color: rgb(0, 0, 0);">Info: x=18.892500 y=20.341400 z=-1.188940</p>
<p style="margin: 0px; text-indent: 0px; color: rgb(0, 0, 0);">Info: x=28.107500 y=20.341400 z=-1.188940</p><p style="margin: 0px; text-indent: 0px; color: rgb(0, 0, 0);"><br></p>
<p style="margin: 0px; text-indent: 0px; color: rgb(0, 0, 0);">Info: distance = 9.855121 with :</p>
<p style="margin: 0px; text-indent: 0px; color: rgb(0, 0, 0);">Info: x=18.446899 y=18.649700 z=-2.155560</p>
<p style="margin: 0px; text-indent: 0px; color: rgb(0, 0, 0);">Info: x=28.107500 y=20.341400 z=-1.188940</p><br>The distance is calculated by the norm of the difference vector between the two provided. As you can see the there is a value with a distance &gt;10, also find_within_range was provided with 10.0f.<br>
<br>The Tree was defined:<br><br>struct sVECTOR<br>{<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; float v[3];<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //some other values<br>&nbsp;};<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;typedef KDTree::KDTree&lt;3, sVECTOR, std::pointer_to_binary_function&lt;sVECTOR, size_t, float&gt; &gt; tTreeType;<br>
<br>The tree was allocated with:<br><br>tree = new tTreeType(std::ptr_fun(tac));<br><br>where tac is:<br><br>inline float KDTreeHandler::tac( KDTreeHandler::sVECTOR t, size_t k )<br>{<br>&nbsp;&nbsp;&nbsp; return t.v[k];<br>}<br><br>The variable vectors provided for  find_within_range is a std::deque&lt;sVECTOR&gt;.<br>
<br>Can anyone give me some advices or recommendations?<br><br>Grettings,<br>Walter<br><br>