Class ExhaustiveNeighbor<P>

java.lang.Object
org.ddogleg.nn.alg.ExhaustiveNeighbor<P>

public class ExhaustiveNeighbor<P>
extends Object
Exhaustively finds the nearest-neighbor to a n-dimensional point by considering every possibility.
  • Constructor Details

    • ExhaustiveNeighbor

      public ExhaustiveNeighbor​(KdTreeDistance<P> distance)
  • Method Details

    • setPoints

      public void setPoints​(List<P> points)
      The input list which the nearest-neighbor is to be found inside of
      Parameters:
      points - List od points
    • findClosest

      public int findClosest​(P p, double maxDistance)
      Finds the index of the point which has the smallest Euclidean distance to 'p' and is < maxDistance away.
      Parameters:
      p - A point.
      maxDistance - The maximum distance (Euclidean squared) the neighbor can be.
      Returns:
      Index of the closest point.
    • findClosestN

      public void findClosestN​(P p, double maxDistance, int numNeighbors, DogArray_I32 outputIndex, DogArray_F64 outputDistance)
      Finds the index of the point which has the smallest Euclidean distance to 'p' and is < maxDistance away.
      Parameters:
      p - A point.
      maxDistance - The maximum distance (Euclidean squared) the neighbor can be.
      numNeighbors - the requested number of nearest neighbors it should search for
      outputIndex - Storage for the index of the closest elements
      outputDistance - Storage for the distance of the closest elements
    • getBestDistance

      public double getBestDistance()