Interface NearestNeighbor.Search<P>

All Known Implementing Classes:
KdTreeInternalSearch
Enclosing interface:
NearestNeighbor<P>

public static interface NearestNeighbor.Search<P>
An independent search instance.
  • Method Summary

    Modifier and Type Method Description
    void findNearest​(P point, double maxDistance, int numNeighbors, DogArray<NnData<P>> results)
    Searches for the N nearest neighbor to the specified point.
    boolean findNearest​(P point, double maxDistance, NnData<P> result)
    Searches for the nearest neighbor to the specified point.
  • Method Details

    • findNearest

      boolean findNearest​(P point, double maxDistance, NnData<P> result)
      Searches for the nearest neighbor to the specified point. The neighbor must be within maxDistance.

      NOTE: How distance is measured is not specified here. See the implementation's documentation. Euclidean distance squared is common.

      Parameters:
      point - (Input) A point being searched for.
      maxDistance - (Input) Maximum distance (inclusive, e.g. d ≤ maxDistance) a neighbor can be from point. Values < 0 will be set to the maximum distance.
      result - (Output) Storage for the result.
      Returns:
      true if a match within the max distance was found.
    • findNearest

      void findNearest​(P point, double maxDistance, int numNeighbors, DogArray<NnData<P>> results)
      Searches for the N nearest neighbor to the specified point. The neighbors must be within maxDistance.

      NOTE: How distance is measured is not specified here. See the implementation's documentation. Euclidean distance squared is common.

      Parameters:
      point - (Input) A point being searched for.
      maxDistance - (Input) Maximum distance (inclusive, e.g. d ≤ maxDistance) the neighbor can be from point. Values < 0 will be set to the maximum distance.
      numNeighbors - (Input) The number of neighbors it will search for.
      results - (Output) Storage for the result. Reset() is called.