Base case: If node is null, the point is not found.
If the current node within range, than sote it.
Calculate current dimension (cd).
Recursive both in left anf right.
470 {
474 if (node == nullptr) return;
475
479 bool satisfied = true;
480 for (
int i = 0; i <
K; i++)
481 {
482 if (std::abs(node->m_Point[i] - point[i]) > condition[i])
483 {
484 satisfied = false;
485 break;
486 }
487 }
488 if (satisfied)
489 {
490 rangePoints.push_back(node->m_Point);
491 }
492
497
501 if (std::abs(node->m_Point[cd] - point[cd]) <= condition[cd])
502 {
503 if (node->m_Left)
504 {
506 }
507 if (node->m_Right)
508 {
510 }
511 }
512 else if (node->m_Point[cd] - point[cd] > 0.0f)
513 {
514 if (node->m_Left)
515 {
517 }
518 }
519 else
520 {
521 if (node->m_Right)
522 {
524 }
525 }
526 }
void range_search_recursive(Node *node, const item &point, const item &condition, std::vector< item > &rangePoints, int depth) const
Recursive function to search for all nearest points in the kd_tree.