Queries are thread-safe and may be done in
parallel using openmp, posix threads, etc.
NN.ksearch(MyPointType Q,
int k,
vector<unsigned long> answer,
double epsilon)
or
NN.ksearch(MyPointType Q,
int k,
vector<unsigned long> answer,
vector<double> distance,
double epsilon)
- Q
- A query point of type MyPointType.
- k
- The number of nearest neighbors
to return. Ie. k=5 will return the 5
nearest points to Q in the data set
- answer
- This vector will contain the indexes
of the k nearest data points. These
indexes are based off the FirstDataPoint
given at initialization. If the points have
been moved, the indexes will be
incorrect.
- distance
- This vector will contain the squared
distance from the query point to the
corresponding data point
- epsilon
- This parameter is optional, and defaults
to 0. This approximation parmater garuntees
that the distance to the farthest returned
point is no farther than (1+eplsilon)*(distance
to actual k nearest neighbor). To compute
an exact solution leave it to be 0.