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
-
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'double
Returns the distance of the closest node.void
setMaxDistance
(double maxDistance) Specifies the greatest distance it will searchvoid
Specifies the tree which will be searched.
-
Constructor Details
-
KdTreeSearch1Standard
-
-
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
-
setMaxDistance
public void setMaxDistance(double maxDistance) Specifies the greatest distance it will search- Specified by:
setMaxDistance
in interfaceKdTreeSearch1<P>
- Parameters:
maxDistance
- Maximum distance (Euclidean squared) a closest point can be
-
findNeighbor
Finds the node which is closest to 'target'- Specified by:
findNeighbor
in 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:KdTreeSearch1
Returns the distance of the closest node.- Specified by:
getDistance
in interfaceKdTreeSearch1<P>
- Returns:
- distance to closest node.
-
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>
-