Interface NearestNeighbor<P>

All Known Implementing Classes:
KdForestBbfNearestNeighbor, KdTreeNearestNeighbor, VpTree, WrapExhaustiveNeighbor

public interface NearestNeighbor<P>

Abstract interface for finding the nearest neighbor to a user specified point inside of a set of points in K-dimensional space. Solution can be exact or approximate, depending on the implementation. The distance metric is intentionally left undefined and is implementation dependent.

WARNING: Do not modify the input lists until after the NN search is no longer needed. If the input lists do need to be modified, then pass in a copy instead. This restriction reduced memory overhead significantly.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    An independent search instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    Creates a new search for this data structure.
    void
    setPoints(List<P> points, boolean trackIndices)
    Specifies the set of points which are to be searched.
  • Method Details

    • setPoints

      void setPoints(List<P> points, boolean trackIndices)
      Specifies the set of points which are to be searched.
      Parameters:
      points - Set of points.
      trackIndices - If true it will keep track of the index. Making it easy to associate data.
    • createSearch

      NearestNeighbor.Search<P> createSearch()
      Creates a new search for this data structure. This is intended to enabled concurrent searches. After setPoints(List, boolean) has been called and returned, each searched can be called independently in separate threads. Do not call setPoints(List, boolean) which a search is being performed.
      Returns:
      A new search object for this instance.