diff options
-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); } } |