Make KDTree help more helpful

nix
Owen Green 6 years ago
parent 5df8513bd6
commit 138f6011e5

@ -117,8 +117,23 @@ fork{
//Return labels of k nearest points to new data
(
~tmpbuf.setn(0,[ 1.0.linrand,1.0.linrand ]);
~tree.kNearest(~tmpbuf,5, { |a| a.postln });
~testpoint = [ 1.0.linrand,1.0.linrand ];
("\n\nTest point:" + ~testpoint).postln;
~tmpbuf.setn(0,~testpoint);
fork{
~tree.kNearest(~tmpbuf,5, { |a|
("Labels of nearest points" + a).postln;
"Nearest points".postln;
a.do{|l|
~dataset.getPoint(l,~tmpbuf,action:{
~tmpbuf.loadToFloatArray(action:{ |point|
point.postln;
})
});
s.sync;
}
});
}
)
//or the distances

Loading…
Cancel
Save