Package org.ddogleg.nn.alg.searches
Class KdTreeSearch1Standard<P>
java.lang.Object
org.ddogleg.nn.alg.searches.KdTreeSearch1Standard<P>
- All Implemented Interfaces:
KdTreeSearch1<P>
Standard algorithm for searching a
KdTree for the nearest-neighbor of a search. This is the algorithm
which is typically described in books. At each node it examines distance of the two children and investigates
the closer child. After it reaches a leaf it steps back in the search and sees if the other child could produce
a better solution, if it can it is also investigated. The search stops when no more nodes can produce a better
result.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncopy()Creates a copy of this search with the same configuration.findNeighbor(P target) Finds the node which is closest to 'target'doubleReturns the distance of the closest node.voidsetMaxDistance(double maxDistance) Specifies the greatest distance it will searchvoidSpecifies the tree which will be searched.
-
Constructor Details
-
KdTreeSearch1Standard
-
-
Method Details
-
setTree
Description copied from interface:KdTreeSearch1Specifies the tree which will be searched. The type of object is implementation specific- Specified by:
setTreein interfaceKdTreeSearch1<P>- Parameters:
tree- search tree
-
setMaxDistance
public void setMaxDistance(double maxDistance) Specifies the greatest distance it will search- Specified by:
setMaxDistancein interfaceKdTreeSearch1<P>- Parameters:
maxDistance- Maximum distance (Euclidean squared) a closest point can be
-
findNeighbor
Finds the node which is closest to 'target'- Specified by:
findNeighborin interfaceKdTreeSearch1<P>- Parameters:
target- A point- Returns:
- Closest node or null if none is within the minimum distance.
-
getDistance
public double getDistance()Description copied from interface:KdTreeSearch1Returns the distance of the closest node.- Specified by:
getDistancein interfaceKdTreeSearch1<P>- Returns:
- distance to closest node.
-
copy
Description copied from interface:KdTreeSearch1Creates a copy of this search with the same configuration. workspace isn't copied- Specified by:
copyin interfaceKdTreeSearch1<P>
-