SpiecsEngine
 
Loading...
Searching...
No Matches

◆ search()

template<uint32_t K>
bool scl::kd_tree< K >::search ( const item & point) const
inline

Search for a point in the kd_tree. Start at the root, comparing the search point’s first dimension with the root’s first dimension. If the search point’s value is less than the root’s, go to the left child; otherwise, go to the right child. At the next level, compare the second dimension. Continue this process, cycling through dimensions. If an exact match is found, return true. If a leaf is reached without finding a match, return false.

Parameters
[in]pointSearched point in k d.
Returns
Returns true if found.

Definition at line 623 of file KDTree.h.

624 {
625 return search_recursive(m_Root, point, 0);
626 }
Node * m_Root
Pointer to the root node of the tree.
Definition KDTree.h:76
bool search_recursive(Node *node, const item &point, int depth) const
Recursive function to search for a point in the kd_tree.
Definition KDTree.h:421

References scl::kd_tree< K >::m_Root, and scl::kd_tree< K >::search_recursive().