Class KdTreeSearch1Bbf<P>

All Implemented Interfaces:

public class KdTreeSearch1Bbf<P> extends KdTreeSearchBestBinFirst<P> implements KdTreeSearch1<P>

Implementation of KdTreeSearchBestBinFirst which searches for the single best nearest-neighbor.

  • Constructor Details

    • KdTreeSearch1Bbf

      public KdTreeSearch1Bbf(KdTreeDistance<P> distance, int maxNodesSearched)
      Configures the search
      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: KdTreeSearch1
      Specifies the tree which will be searched. The type of object is implementation specific
      Specified by:
      setTree in interface KdTreeSearch1<P>
      tree - search tree
    • findNeighbor

      @Nullable public KdTree.Node findNeighbor(P target)
      Description copied from interface: KdTreeSearch1
      Searches for the nearest neighbor to the target. If no point is found that is less than maxDistance then return null.
      Specified by:
      findNeighbor in interface KdTreeSearch1<P>
      target - Point whose nearest neighbor is being searched for
      The closest point or null if there is none.
    • getDistance

      public double getDistance()
      Description copied from interface: KdTreeSearch1
      Returns the distance of the closest node.
      Specified by:
      getDistance in interface KdTreeSearch1<P>
      distance to closest node.
    • 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>
      distanceSq - The distance being considered
      true if it can be better or false if not
    • copy

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