Class KdTreeSearchNBbf<P>

java.lang.Object
org.ddogleg.nn.alg.searches.KdTreeSearchBestBinFirst<P>
org.ddogleg.nn.alg.searches.KdTreeSearchNBbf<P>
All Implemented Interfaces:
KdTreeSearchN<P>

public class KdTreeSearchNBbf<P> extends KdTreeSearchBestBinFirst<P> implements KdTreeSearchN<P>

Implementation of KdTreeSearchBestBinFirst which searches for the N nearest-neighbors.

  • Constructor Details

    • KdTreeSearchNBbf

      public KdTreeSearchNBbf(KdTreeDistance<P> distance, int maxNodesSearched)
      Configures the search
      Parameters:
      maxNodesSearched - Maximum number of nodes it will search. Used to limit CPU time.
  • Method Details

    • setTree

      public void setTree(Object tree)
      Description copied from interface: KdTreeSearchN
      Specifies the tree which will be searched. The type of object is implementation specific
      Specified by:
      setTree in interface KdTreeSearchN<P>
      Parameters:
      tree - search tree
    • findNeighbor

      public void findNeighbor(P target, int searchN, DogArray<KdTreeResult> results)
      Description copied from interface: KdTreeSearchN
      Searches for the N nearest-neighbors to the target. The results are added to the 'results' list.
      Specified by:
      findNeighbor in interface KdTreeSearchN<P>
      Parameters:
      target - Point whose nearest neighbor is being searched for
      searchN - Number of closest points it will find. Must be >= 1
      results - Storage for the found neighbors.
    • copy

      public KdTreeSearchN<P> copy()
      Description copied from interface: KdTreeSearchN
      Creates a copy of this search with the same configuration. workspace isn't copied
      Specified by:
      copy in interface KdTreeSearchN<P>
    • checkBestDistance

      protected void checkBestDistance(KdTree.Node node, P target)
      Checks to see if the current node's point is the closet point found so far
      Specified by:
      checkBestDistance in class KdTreeSearchBestBinFirst<P>
    • canImprove

      protected boolean canImprove(double distanceSq)
      Description copied from class: KdTreeSearchBestBinFirst
      Checks to see if it is possible for this distance to improve upon the current best
      Specified by:
      canImprove in class KdTreeSearchBestBinFirst<P>
      Parameters:
      distanceSq - The distance being considered
      Returns:
      true if it can be better or false if not