Skip to content

Commit

Permalink
use the maximum distance to hyper rectangle to add all points in the …
Browse files Browse the repository at this point in the history
…subtree

TODO: This should be done by only looking at the change in the split_dim from the parent
  • Loading branch information
KristofferC authored and KristofferC committed Jun 18, 2024
1 parent db34fdb commit 67a1bad
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/kd_tree.jl
Original file line number Diff line number Diff line change
Expand Up @@ -226,18 +226,24 @@ function inrange_kernel!(tree::KDTree,
return 0
end

M = tree.metric

# At a leaf node. Go through all points in node and add those in range
if isleaf(tree.tree_data.n_internal_nodes, index)
return add_points_inrange!(idx_in_ball, tree, index, point, r, false)
end

max_dist = get_max_distance_no_end(M, hyper_rec, point)
if max_dist < r
return addall(tree, index, idx_in_ball)
end

split_val = tree.split_vals[index]
split_dim = tree.split_dims[index]
lo = hyper_rec.mins[split_dim]
hi = hyper_rec.maxes[split_dim]
p_dim = point[split_dim]
split_diff = p_dim - split_val
M = tree.metric

count = 0

Expand Down

0 comments on commit 67a1bad

Please sign in to comment.