SpiecsEngine
 
Loading...
Searching...
No Matches

◆ print_recursive()

template<uint32_t K>
void scl::kd_tree< K >::print_recursive ( Node * node,
int depth ) const
inlineprivate

Recursive function to print the kd_tree.

Parameters
[in]noderecursive node.
[in]depthrecursive depth.

Base case: If node is null, return.

Print current node with indentation based on depth.

Recursively print left and right children.

Definition at line 529 of file KDTree.h.

530 {
534 if (node == nullptr) return;
535
539 for (int i = 0; i < depth; i++)
540 {
541 std::cout << " ";
542 }
543
544 std::cout << "(";
545 for (size_t i = 0; i < K; i++)
546 {
547 std::cout << node->m_Point[i];
548 if (i < K - 1)
549 {
550 std::cout << ", ";
551 }
552 }
553 std::cout << ")" << std::endl;
554
558 print_recursive(node->m_Left, depth + 1);
559 print_recursive(node->m_Right, depth + 1);
560 }
void print_recursive(Node *node, int depth) const
Recursive function to print the kd_tree.
Definition KDTree.h:529

References scl::kd_tree< K >::print_recursive().

Referenced by scl::kd_tree< K >::print(), and scl::kd_tree< K >::print_recursive().