Insert a point into the kd_tree. Start at the root, comparing the new point’s first dimension with the root’s first dimension. If the new 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. When a leaf is reached, create a new node and insert the new point.
- Parameters
-
| [in] | points | Inserted points in k d. |
Definition at line 602 of file KDTree.h.
603 {
605 }
void insert_recursive(Node *&node, std::shared_ptr< std::vector< item > > points, int depth)
Recursive function to insert a point into the kd_tree.
Node * m_Root
Pointer to the root node of the tree.