summaryrefslogtreecommitdiffstats
path: root/kd-forest.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2014-08-04 14:39:12 -0400
committerTavian Barnes <tavianator@tavianator.com>2014-08-04 14:39:12 -0400
commit8e5774ee9f5296dcbc831897dbf55f3031e3d348 (patch)
tree4cb7cb5183613124942afaec6a4efd622008e6ca /kd-forest.c
parent25d1e5341b34db0855c2dd2823a2f2af94093803 (diff)
downloadkd-forest-8e5774ee9f5296dcbc831897dbf55f3031e3d348.tar.xz
More constness.
Diffstat (limited to 'kd-forest.c')
-rw-r--r--kd-forest.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/kd-forest.c b/kd-forest.c
index 759c41e..3716537 100644
--- a/kd-forest.c
+++ b/kd-forest.c
@@ -137,7 +137,7 @@ kd_build_tree(kd_node_t **buffers[KD_BUFSIZE], size_t size)
}
static double
-kd_distance_sq(double a[KD_DIMEN], double b[KD_DIMEN])
+kd_distance_sq(const double a[KD_DIMEN], const double b[KD_DIMEN])
{
double result = 0.0;
for (int i = 0; i < KD_DIMEN; ++i) {
@@ -148,7 +148,7 @@ kd_distance_sq(double a[KD_DIMEN], double b[KD_DIMEN])
}
static void
-kd_find_nearest_recursive(kd_node_t *node, double target[KD_DIMEN], double closest[KD_DIMEN], kd_node_t **best, double *limit, unsigned int coord)
+kd_find_nearest_recursive(kd_node_t *node, const double target[KD_DIMEN], const double closest[KD_DIMEN], kd_node_t **best, double *limit, unsigned int coord)
{
if (!node->removed) {
double node_dist_sq = kd_distance_sq(node->coords, target);
@@ -186,7 +186,7 @@ kd_find_nearest_recursive(kd_node_t *node, double target[KD_DIMEN], double close
}
static void
-kd_find_nearest(kd_node_t *root, double target[KD_DIMEN], kd_node_t **best, double *limit)
+kd_find_nearest(kd_node_t *root, const double target[KD_DIMEN], kd_node_t **best, double *limit)
{
kd_find_nearest_recursive(root, target, target, best, limit, 0);
}
@@ -289,7 +289,7 @@ kdf_remove(kd_forest_t *kdf, kd_node_t *node)
}
kd_node_t *
-kdf_find_nearest(kd_forest_t *kdf, double target[KD_DIMEN])
+kdf_find_nearest(const kd_forest_t *kdf, const double target[KD_DIMEN])
{
double limit = INFINITY;
kd_node_t *best = NULL;