Package org.ddogleg.nn.alg.searches
Class KdTreeSearch1Bbf<P>
java.lang.Object
org.ddogleg.nn.alg.searches.KdTreeSearchBestBinFirst<P>
org.ddogleg.nn.alg.searches.KdTreeSearch1Bbf<P>
- All Implemented Interfaces:
KdTreeSearch1<P>
Implementation of KdTreeSearchBestBinFirst
which searches for the single best nearest-neighbor.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.ddogleg.nn.alg.searches.KdTreeSearchBestBinFirst
KdTreeSearchBestBinFirst.Helper
-
Field Summary
Fields inherited from class org.ddogleg.nn.alg.searches.KdTreeSearchBestBinFirst
bestDistanceSq, maxNodesSearched, N, numNodesSearched
-
Constructor Summary
ConstructorDescriptionKdTreeSearch1Bbf
(KdTreeDistance<P> distance, int maxNodesSearched) Configures the search -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
canImprove
(double distanceSq) Checks to see if it is possible for this distance to improve upon the current bestprotected void
checkBestDistance
(KdTree.Node node, P target) Checks to see if the current node's point is the closet point found so farcopy()
Creates a copy of this search with the same configuration.findNeighbor
(P target) Searches for the nearest neighbor to the target.double
Returns the distance of the closest node.void
Specifies the tree which will be searched.Methods inherited from class org.ddogleg.nn.alg.searches.KdTreeSearchBestBinFirst
_findClosest, addToQueue, searchNode, setMaxDistance, setTree, setTrees
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.ddogleg.nn.alg.KdTreeSearch1
setMaxDistance
-
Constructor Details
-
KdTreeSearch1Bbf
Configures the search- Parameters:
maxNodesSearched
- Maximum number of nodes it will search. Used to limit CPU time.
-
-
Method Details
-
setTree
Description copied from interface:KdTreeSearch1
Specifies the tree which will be searched. The type of object is implementation specific- Specified by:
setTree
in interfaceKdTreeSearch1<P>
- Parameters:
tree
- search tree
-
findNeighbor
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 interfaceKdTreeSearch1<P>
- Parameters:
target
- Point whose nearest neighbor is being searched for- Returns:
- 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 interfaceKdTreeSearch1<P>
- Returns:
- distance to closest node.
-
checkBestDistance
Checks to see if the current node's point is the closet point found so far- Specified by:
checkBestDistance
in classKdTreeSearchBestBinFirst<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 classKdTreeSearchBestBinFirst<P>
- Parameters:
distanceSq
- The distance being considered- Returns:
- true if it can be better or false if not
-
copy
Description copied from interface:KdTreeSearch1
Creates a copy of this search with the same configuration. workspace isn't copied- Specified by:
copy
in interfaceKdTreeSearch1<P>
-