bufstats + kdtree: updated help for clarity of behaviours

nix
Pierre Alexandre Tremblay 5 years ago
parent 63b5a4021e
commit 09e8dfb7f1

@ -175,7 +175,7 @@ b = Buffer.alloc(s,101,2);
b.setn(0, Array.fill(101,{|i|[i / 100,-1.0.rand]}).flat);
// plot to confirm
b.plot
b.plot.plotMode_(\points)
// create a new buffer as destinations
c = Buffer.new(s);
@ -233,8 +233,12 @@ FluidBufStats.process(s, b, stats:d, numDerivs:1, action:{d.getn(0,d.numFrames,{
// run the same array with the weights
FluidBufStats.process(s, b, stats:d, numDerivs:1, weights: c, action:{d.getn(0,d.numFrames * d.numChannels,{|item|item.postln})});
// example 2b (run the stats above)
e = [(1..9), 0.series(-10,-80)].flop.scramble.flop; // this has only negative weights, so nothing happens
// example 2b
e = [(1..9), 0.series(-10,-80)].flop.scramble.flop;
b = Buffer.loadCollection(s,e[0]);
c = Buffer.loadCollection(s,e[1]);
FluidBufStats.process(s, b, stats:d, numDerivs:1, weights: c, action:{d.getn(0,d.numFrames * d.numChannels,{|item|item.postln})});
// this has only negative weights, so it bails out.
// but if we scale them up
g = Buffer(s)
FluidBufScale.process(s,c,destination: g,inputLow: -100,inputHigh: 0)

@ -74,7 +74,6 @@ fork{
~tree.size;
~tree.cols;
//Return the labels of k nearest points to a new point
(
~p = [ 1.0.linrand,1.0.linrand ];
@ -97,6 +96,7 @@ 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.numNeighbours = 0; // 0 will return all items in order of distance
// Limit the search to an acceptable distance in a radius
@ -129,6 +129,8 @@ code::
~predictPoint = Buffer.alloc(s,5);
~pitchingBus = Bus.control;
~catchingBus = Bus.control;
~tree.numNeighbours = 5;
~tree.radius = 0;
)
//populate the lookupDataSet

Loading…
Cancel
Save