@ -92,15 +92,17 @@ fork{
// Explore changing the number of neighbourgs
~tree.numNeighbours = 11; // note that this value needs to be sent to the server
~tree.kNearest(~tmpbuf,{ |a|a.postln;~nearest = a; });
~tree.kNearest(~tmpbuf,{ |a|a.postln;});
~tree.numNeighbours = 0; // 0 will return all items in order of distance
~tree.kNearest(~tmpbuf,{ |a|a.postln;});
// Limit the search to an acceptable distance in a radius
// Define a point, and observe typical distance values
~p = [ 0.4,0.4];
(
~tmpbuf = Buffer.loadCollection(s, ~p, 1, {
~tree.kNearestDist(~tmpbuf,{ |a|a.postln;~nearest = a;});
~tree.kNearest(~tmpbuf,{ |a|a.postln;});
~tree.kNearestDist(~tmpbuf,{ |a|a.postln;});
});
)
@ -109,7 +111,7 @@ fork{
// FluidKDTree will return only values that are within that radius, up to numNeighbours values
(
~tmpbuf = Buffer.loadCollection(s, ~p, 1, {
~tree.kNearest(~tmpbuf,{ |a|a.postln;~nearest = a; });
~tree.kNearest(~tmpbuf,{ |a|a.postln;});
});
)
::