Class that implements the KDTree partition of 2D space and a closest point search algorithm. More...
#include <PreProcessingAlgorithm.h>
Public Member Functions | |
KDTreeLinkerAlgo () | |
Default constructor. More... | |
~KDTreeLinkerAlgo () | |
Destructor calls clear. More... | |
void | build (std::vector< KDTreeNodeInfoT< DATA, DIM >> &eltList, const KDTreeBoxT< DIM > ®ion) |
Build the KD tree from the "eltList" in the space define by "region". More... | |
void | search (const KDTreeBoxT< DIM > &searchBox, std::vector< KDTreeNodeInfoT< DATA, DIM >> &resRecHitList) |
Search in the KDTree for all points that would be contained in the given searchbox The founded points are stored in resRecHitList. More... | |
void | findNearestNeighbour (const KDTreeNodeInfoT< DATA, DIM > &point, const KDTreeNodeInfoT< DATA, DIM > *&result, float &distance) |
findNearestNeighbour More... | |
bool | empty () |
Whether the tree is empty. More... | |
int | size () |
Return the number of nodes + leaves in the tree (nElements should be (size() +1) / 2) More... | |
void | clear () |
Clear all allocated structures. More... | |
Private Member Functions | |
KDTreeNodeT< DATA, DIM > * | getNextNode () |
Get the next node from the node pool. More... | |
int | medianSearch (int low, int high, int treeDepth) |
Fast median search with Wirth algorithm in eltList between low and high indexes. More... | |
KDTreeNodeT< DATA, DIM > * | recBuild (int low, int high, int depth, const KDTreeBoxT< DIM > ®ion) |
Recursive kdtree builder. Is called by build() More... | |
void | recSearch (const KDTreeNodeT< DATA, DIM > *current, const KDTreeBoxT< DIM > &trackBox) |
Recursive kdtree search. Is called by search() More... | |
void | recNearestNeighbour (unsigned depth, const KDTreeNodeT< DATA, DIM > *current, const KDTreeNodeInfoT< DATA, DIM > &point, const KDTreeNodeT< DATA, DIM > *&best_match, float &best_dist) |
Recursive nearest neighbour search. Is called by findNearestNeighbour() More... | |
void | addSubtree (const KDTreeNodeT< DATA, DIM > *current) |
Add all elements of an subtree to the closest elements. Used during the recSearch(). More... | |
float | dist2 (const KDTreeNodeInfoT< DATA, DIM > &a, const KDTreeNodeInfoT< DATA, DIM > &b) const |
dist2 More... | |
void | clearTree () |
Frees the KDTree. More... | |
Private Attributes | |
KDTreeNodeT< DATA, DIM > * | root_ |
The KDTree root. More... | |
KDTreeNodeT< DATA, DIM > * | nodePool_ |
Node pool allows us to do just 1 call to new for each tree building. More... | |
int | nodePoolSize_ |
The node pool size. More... | |
int | nodePoolPos_ |
The node pool position. More... | |
std::vector< KDTreeNodeInfoT < DATA, DIM > > * | closestNeighbour |
The closest neighbour. More... | |
std::vector< KDTreeNodeInfoT < DATA, DIM > > * | initialEltList |
The initial element list. More... | |
Class that implements the KDTree partition of 2D space and a closest point search algorithm.
Definition at line 17 of file PreProcessingAlgorithm.h.
|
inline |
Default constructor.
Definition at line 162 of file KDTreeLinkerAlgoT.h.
|
inline |
Destructor calls clear.
Definition at line 175 of file KDTreeLinkerAlgoT.h.
|
inlineprivate |
Add all elements of an subtree to the closest elements. Used during the recSearch().
current |
Definition at line 421 of file KDTreeLinkerAlgoT.h.
|
inline |
Build the KD tree from the "eltList" in the space define by "region".
eltList | |
region |
Definition at line 183 of file KDTreeLinkerAlgoT.h.
|
inline |
Clear all allocated structures.
Definition at line 486 of file KDTreeLinkerAlgoT.h.
|
inlineprivate |
Frees the KDTree.
Definition at line 458 of file KDTreeLinkerAlgoT.h.
|
inlineprivate |
|
inline |
Whether the tree is empty.
Definition at line 470 of file KDTreeLinkerAlgoT.h.
|
inline |
findNearestNeighbour
point | |
result | |
distance |
Definition at line 334 of file KDTreeLinkerAlgoT.h.
|
inlineprivate |
Get the next node from the node pool.
Definition at line 495 of file KDTreeLinkerAlgoT.h.
|
inlineprivate |
Fast median search with Wirth algorithm in eltList between low and high indexes.
low | |
high | |
treeDepth |
Definition at line 202 of file KDTreeLinkerAlgoT.h.
|
inlineprivate |
Recursive kdtree builder. Is called by build()
low | |
high | |
depth | |
region |
Definition at line 509 of file KDTreeLinkerAlgoT.h.
|
inlineprivate |
Recursive nearest neighbour search. Is called by findNearestNeighbour()
depth | |
current | |
point | |
best_match | |
best_dist |
Definition at line 359 of file KDTreeLinkerAlgoT.h.
|
inlineprivate |
Recursive kdtree search. Is called by search()
current | |
trackBox |
Definition at line 262 of file KDTreeLinkerAlgoT.h.
|
inline |
Search in the KDTree for all points that would be contained in the given searchbox The founded points are stored in resRecHitList.
searchBox | |
resRecHitList |
Definition at line 249 of file KDTreeLinkerAlgoT.h.
|
inline |
Return the number of nodes + leaves in the tree (nElements should be (size() +1) / 2)
Definition at line 478 of file KDTreeLinkerAlgoT.h.
|
private |
The closest neighbour.
Definition at line 154 of file KDTreeLinkerAlgoT.h.
|
private |
The initial element list.
Definition at line 155 of file KDTreeLinkerAlgoT.h.
|
private |
Node pool allows us to do just 1 call to new for each tree building.
Definition at line 150 of file KDTreeLinkerAlgoT.h.
|
private |
The node pool position.
Definition at line 152 of file KDTreeLinkerAlgoT.h.
|
private |
The node pool size.
Definition at line 151 of file KDTreeLinkerAlgoT.h.
|
private |
The KDTree root.
Definition at line 149 of file KDTreeLinkerAlgoT.h.