Skip to content

Commit

Permalink
use max double instead of hardcode val
Browse files Browse the repository at this point in the history
  • Loading branch information
leonmavr committed Sep 16, 2024
1 parent 8a22f20 commit a9bf72e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/quad.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <assert.h>
#include <string.h>
#include <unistd.h>
#include <float.h> // DOUBLE_MAX

#define MAX(a, b) ((a) > (b) ? (a) : (b))

Expand Down Expand Up @@ -206,7 +207,7 @@ void node_nearest_neighbor(node_t* node, point_t* query, point_t* nearest, doubl
}

double qtree_nearest_neighbor(quadtree_t* qtree, point_t* query, point_t* nearest) {
double best_dist_squared = 999999999.;
double best_dist_squared = DBL_MAX;
node_nearest_neighbor(qtree->root, query, nearest, &best_dist_squared);
return best_dist_squared;
}
Expand Down

0 comments on commit a9bf72e

Please sign in to comment.