/** * Locate nearest neighbours for a given point in space. * @param nMin number of entries to be returned. More entries may or may not be returned if * several points have the same distance. * @param dist Distance function. Note that the distance function should be compatible * with the preprocessor of the tree. * @param key the center point * @return KNN query iterator. */ public PhKnnQueryF<T> nearestNeighbour(int nMin, PhDistance dist, double... key) { long[] lKey = new long[key.length]; pre.pre(key, lKey); PhKnnQuery<T> iter = pht.nearestNeighbour(nMin, dist, null, lKey); return new PhKnnQueryF<>(iter, pht.getDim(), pre); }
/** * Locate nearest neighbours for a given point in space. * @param nMin number of entries to be returned. More entries may or may not be returned if * several points have the same distance. * @param key the center point * @return List of neighbours. */ public PhKnnQueryF<T> nearestNeighbour(int nMin, double... key) { long[] lKey = new long[key.length]; pre.pre(key, lKey); PhKnnQuery<T> iter = pht.nearestNeighbour(nMin, PhDistanceF.THIS, null, lKey); return new PhKnnQueryF<>(iter, pht.getDim(), pre); }