Closed hsnetzer closed 5 years ago
The changes are great!
Do you think you could illustrate the importance of abs(dimensionDifference)
with a test example that fails previously and succeeds with the proposed change?
Probably can't make a test case, its more an efficiency thing. You want to search the other subtree if the radius crosses the hyperplane. That is when the distance to the hyperplane is less than r
. dimensionDifference
represents displacement to the hyperplane, i.e. it can be negative. When we test for r > dimensionDifference
we end up searching more than is needed.
the comment should be changed too. “the hyperplane at the other side of this value” doesn’t really make sense because the value is on the hyperplane.
True that, thank you for the explanation.
You can correct the comment as part of the PR if you like, since you pointed it out :)
Yay! I also fixed a typo in the readme.
We need to take the absolute value of the dimensionDifference to fairly compare it to the radius.
Also, I like checking the node value after we see if the radius intersects the hyperplain.
This build should pass with a small speedup to allPoints(within: of:)