This UGen takes an input point (such as a 2D or 3D location) and searches for the nearest few points in a dataset (by Euclidean distance).
You need the KDTree quark to generate the data for this UGen.
treebuf |
a Buffer containing data which MUST be in the special format created using the KDTree class and NearestN.makeBufferData |
in |
An array representing the input point. Num channels must match the dimensionality of the points in the dataset |
gate |
The unit is active while gate > 0. While <=0, no search is performed and output is held steady |
num |
Number of points to retrieve. NOT modulatable. |
A flat array containing (3 * num) channels, which is a ranked list of the nearest items (the very nearest coming first). For each match, this returns three channels [treeindex, distancesquared, label]
Processes a KDTree into a special format that can be loaded into a Buffer, and then searched by this UGen.
The most basic workflow is something like this:
This more complete example shows it in action: