Repository navigation
Conversation
Visit the near child first and the far child only when the splitting plane is within the search radius. Results are unchanged; add tests that compare both searches with a brute-force search and check that a search visits far fewer nodes than the tree has.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #281.
_search_nearest_neighbor_candidatesnow visits the near child first, and the far child only when the distance from the target to the splitting plane is within the search radius. The public methods and their results are unchanged. This is used by bothsearch_nearest_neighbor_pointandsearch_neighbor_points_within_r.Nodes visited per search, averaged over 50 random targets:
How I checked it works
test/test_kd_tree.py:rmatch a brute-force search for random clouds of 10, 100 and 1000 pointsmain, where every node is visited)rfor every target.pytest -lon the whole suite: 145 passed.Images
Last frame of the two simulations that use the kd-tree, before and after.
search_nearest_neighbor_kd_treeis identical pixel for pixel. Insearch_neighbor_points_kd_treethe same neighbors are found, but they come back in a different order, so the green lines are drawn in a different order and 9 pixels differ where they overlap at the target.Book
Section 9.1 has no page yet (Book section 9.1: kd-tree search #282), so there is no "Limits" note to remove.