From 03383e4c753d386712fd92c714bde46e2cdbd7e7 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Tue, 11 Mar 2014 21:12:56 -0400 Subject: Look for strictly better matches in the k-d tree code. --- kd-forest.c | 4 ++-- 1 file 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); } } -- cgit v1.2.3