diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2014-03-11 21:12:56 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2014-03-11 21:12:56 -0400 |
commit | 03383e4c753d386712fd92c714bde46e2cdbd7e7 (patch) | |
tree | 6cacbcb71d95f10688718d7f90a2a0c95e60bd1f | |
parent | fd5651a159da880b0c378ae9d2a2b4ac1c0614b3 (diff) | |
download | kd-forest-03383e4c753d386712fd92c714bde46e2cdbd7e7.tar.xz |
Look for strictly better matches in the k-d tree code.
-rw-r--r-- | kd-forest.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/kd-forest.c b/kd-forest.c index 5b230be..f1e8f0b 100644 --- a/kd-forest.c +++ b/kd-forest.c @@ -163,10 +163,10 @@ kd_find_nearest_recursive(kd_node_t *root, kd_node_t *target, kd_node_t **best, coord = (coord + 1)%KD_DIMEN; - if (root->left && (dist <= 0 || dist_sq <= *limit)) { + if (root->left && (dist < 0.0 || dist_sq < *limit)) { kd_find_nearest_recursive(root->left, target, best, limit, coord); } - if (root->right && (dist >= 0 || dist_sq <= *limit)) { + if (root->right && (dist > 0.0 || dist_sq < *limit)) { kd_find_nearest_recursive(root->right, target, best, limit, coord); } } |