Commit 480a091e authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

kdtreelib: replace float by kdata_t

parent 5cd6ab45
......@@ -22,10 +22,29 @@
#include <stdio.h>
#include <string.h>
#define KDATA_T float
typedef KDATA_T kdata_t;
//#if KDATA_T == int
//# define KDATA_SCALE(x) ((int) (0.5+100000000*(x)))
//# define KDATA_INVSCALE(x) ((x)/100000000.)
/*
# define KDATA_SCALE(x) ((int) (0.5+10000000*(x)))
# define KDATA_INVSCALE(x) ((x)/10000000.)
# define KDATA_ABS(x) abs(x)
#else
*/
# define KDATA_SCALE(x) (x)
# define KDATA_INVSCALE(x) (x)
# define KDATA_ABS(x) fabs(x)
//#endif
#define KD_MAX_DIM 3
typedef struct kd_point {
float point[KD_MAX_DIM];
kdata_t point[KD_MAX_DIM];
unsigned index;
} kd_point;
......@@ -34,9 +53,9 @@ typedef struct kd_point {
* \brief kd-tree node structure definition
*/
typedef struct kdNode {
float location[KD_MAX_DIM]; /*!<vector to the node's location */
float min[KD_MAX_DIM]; /*!<vector to the min coordinates of the hyperrectangle */
float max[KD_MAX_DIM]; /*!<vector to the max coordinates of the hyperrectangle */
kdata_t location[KD_MAX_DIM]; /*!<vector to the node's location */
kdata_t min[KD_MAX_DIM]; /*!<vector to the min coordinates of the hyperrectangle */
kdata_t max[KD_MAX_DIM]; /*!<vector to the max coordinates of the hyperrectangle */
int split; /*!<axis along which the tree bifurcates */
unsigned index; /*!<optional index value */
struct kdNode *left; /*!<the left child of the tree node */
......@@ -49,7 +68,7 @@ typedef struct kdNode {
*/
typedef struct resItem {
struct kdNode *node; /*!<pointer to a kdNode */
float dist_sq; /*!<distance squared as the priority */
kdata_t dist_sq; /*!<distance squared as the priority */
} resItem;
/*!
......@@ -71,8 +90,8 @@ typedef struct kd_thread_data {
int max_threads;
struct kd_point *points;
unsigned long nPoints;
float min[KD_MAX_DIM];
float max[KD_MAX_DIM];
kdata_t min[KD_MAX_DIM];
kdata_t max[KD_MAX_DIM];
int depth;
int dim;
} kd_thread_data;
......@@ -94,14 +113,14 @@ struct resItem **pqpeek_max(struct pqueue *q, struct resItem **d);
void *kd_malloc(size_t size, const char *msg);
int kd_isleaf(struct kdNode *n);
/* Cartesian */
float kd_sqr(float a);
float kd_min(float x, float y);
kdata_t kd_sqr(kdata_t a);
kdata_t kd_min(kdata_t x, kdata_t y);
/* Spherical */
float kd_sph_orth_dist(float *p1, float *p2, int split);
float kd_sph_dist_sq(float *x, float *y);
float kd_sph_dist(float *x, float *y);
float kd_sph_bearing(float *p1, float *p2);
float kd_sph_xtd(float *p1, float *p2, float *p3);
kdata_t kd_sph_orth_dist(kdata_t *p1, kdata_t *p2, int split);
kdata_t kd_sph_dist_sq(kdata_t *x, kdata_t *y);
kdata_t kd_sph_dist(kdata_t *x, kdata_t *y);
kdata_t kd_sph_bearing(kdata_t *p1, kdata_t *p2);
kdata_t kd_sph_xtd(kdata_t *p1, kdata_t *p2, kdata_t *p3);
/* helper functions for debugging */
void kd_printNode(struct kdNode *node);
......@@ -110,60 +129,60 @@ void kd_printTree(struct kdNode *node);
/* Functions for building and destroying trees */
void kd_freeNode(kdNode * node);
struct kdNode *kd_allocNode(struct kd_point *points, unsigned long pivot,
float *min, float *max, int dim, int axis);
kdata_t *min, kdata_t *max, int dim, int axis);
void kd_destroyTree(struct kdNode *node);
struct kd_thread_data *kd_buildArg(struct kd_point *points,
unsigned long nPoints,
float *min, float *max,
kdata_t *min, kdata_t *max,
int depth, int max_threads,
int dim);
struct kdNode *kd_buildTree(struct kd_point *points, unsigned long nPoints,
float *min, float *max, int dim, int max_threads);
kdata_t *min, kdata_t *max, int dim, int max_threads);
void *kd_doBuildTree(void *threadarg);
struct kdNode *kd_sph_buildTree(struct kd_point *points,
unsigned long nPoints,
float *min, float *max,
kdata_t *min, kdata_t *max,
int max_threads);
void *kd_sph_doBuildTree(void *threadarg);
/* Functions for range searches
* Cartesian
*/
int kd_isPointInRect(struct kdNode *node, float *min, float *max, int dim);
int kd_isRectInRect(struct kdNode *node, float *min, float *max, int dim);
int kd_rectOverlapsRect(struct kdNode *node, float *min, float *max, int dim);
struct pqueue *kd_ortRangeSearch(struct kdNode *node, float *min, float *max,
int kd_isPointInRect(struct kdNode *node, kdata_t *min, kdata_t *max, int dim);
int kd_isRectInRect(struct kdNode *node, kdata_t *min, kdata_t *max, int dim);
int kd_rectOverlapsRect(struct kdNode *node, kdata_t *min, kdata_t *max, int dim);
struct pqueue *kd_ortRangeSearch(struct kdNode *node, kdata_t *min, kdata_t *max,
int dim);
int kd_doOrtRangeSearch(struct kdNode *node, float *min, float *max, int dim,
int kd_doOrtRangeSearch(struct kdNode *node, kdata_t *min, kdata_t *max, int dim,
struct pqueue *res);
struct kdNode *kd_nearest(struct kdNode *node, float *p, float *max_dist_sq,
struct kdNode *kd_nearest(struct kdNode *node, kdata_t *p, kdata_t *max_dist_sq,
int dim);
struct pqueue *kd_qnearest(struct kdNode *node, float *p,
float *max_dist_sq, unsigned int q, int dim);
int kd_doQnearest(struct kdNode *node, float *p,
float *max_dist_sq, unsigned int q, int dim,
struct pqueue *kd_qnearest(struct kdNode *node, kdata_t *p,
kdata_t *max_dist_sq, unsigned int q, int dim);
int kd_doQnearest(struct kdNode *node, kdata_t *p,
kdata_t *max_dist_sq, unsigned int q, int dim,
struct pqueue *res);
struct pqueue *kd_range(struct kdNode *node, float *p, float *max_dist_sq,
struct pqueue *kd_range(struct kdNode *node, kdata_t *p, kdata_t *max_dist_sq,
int dim, int ordered);
int kd_doRange(struct kdNode *node, float *p, float *max_dist_sq,
int kd_doRange(struct kdNode *node, kdata_t *p, kdata_t *max_dist_sq,
int dim, struct pqueue *res, int ordered);
/* spherical */
int kd_sph_isPointInRect(struct kdNode *node, float *min, float *max);
int kd_sph_isRectInRect(struct kdNode *node, float *min, float *max);
int kd_sph_rectOverlapsRect(struct kdNode *node, float *min, float *max);
struct pqueue *kd_sph_ortRangeSearch(struct kdNode *node, float *min,
float *max);
int kd_sph_doOrtRangeSearch(struct kdNode *node, float *min, float *max,
int kd_sph_isPointInRect(struct kdNode *node, kdata_t *min, kdata_t *max);
int kd_sph_isRectInRect(struct kdNode *node, kdata_t *min, kdata_t *max);
int kd_sph_rectOverlapsRect(struct kdNode *node, kdata_t *min, kdata_t *max);
struct pqueue *kd_sph_ortRangeSearch(struct kdNode *node, kdata_t *min,
kdata_t *max);
int kd_sph_doOrtRangeSearch(struct kdNode *node, kdata_t *min, kdata_t *max,
struct pqueue *res);
struct kdNode *kd_sph_nearest(struct kdNode *node, float *p,
float *max_dist_sq);
struct pqueue *kd_sph_qnearest(struct kdNode *node, float *p,
float *max_dist_sq, unsigned int q);
int kd_sph_doQnearest(struct kdNode *node, float *p,
float *max_dist_sq, unsigned int q, struct pqueue *res);
struct pqueue *kd_sph_range(struct kdNode *node, float *p, float *max_dist_sq,
struct kdNode *kd_sph_nearest(struct kdNode *node, kdata_t *p,
kdata_t *max_dist_sq);
struct pqueue *kd_sph_qnearest(struct kdNode *node, kdata_t *p,
kdata_t *max_dist_sq, unsigned int q);
int kd_sph_doQnearest(struct kdNode *node, kdata_t *p,
kdata_t *max_dist_sq, unsigned int q, struct pqueue *res);
struct pqueue *kd_sph_range(struct kdNode *node, kdata_t *p, kdata_t *max_dist_sq,
int ordered);
int kd_sph_doRange(struct kdNode *node, float *p, float *max_dist_sq,
int kd_sph_doRange(struct kdNode *node, kdata_t *p, kdata_t *max_dist_sq,
struct pqueue *res, int ordered);
/* Functions for results heaps */
......
......@@ -15,24 +15,23 @@
********************************************************************* */
static
float square(const float x)
kdata_t square(const kdata_t x)
{
return x*x;
}
static
float kd_dist_sq(const float *restrict a, const float *restrict b, int dim)
kdata_t kd_dist_sq(const kdata_t *restrict a, const kdata_t *restrict b, int dim)
{
return (square((a[0]-b[0]))+square((a[1]-b[1]))+square((a[2]-b[2])));
}
inline float
kd_dist_sq_ori(float *x, float *y, int dim)
inline kdata_t
kd_dist_sq_ori(kdata_t *x, kdata_t *y, int dim)
{
int i;
float dsq = 0;
kdata_t dsq = 0;
if (!x || !y)
return -1;
......@@ -42,8 +41,8 @@ kd_dist_sq_ori(float *x, float *y, int dim)
return dsq;
}
inline float
kd_min(float x, float y)
inline kdata_t
kd_min(kdata_t x, kdata_t y)
{
return x < y ? x : y;
}
......@@ -86,7 +85,7 @@ kd_min(float x, float y)
*/
struct kdNode *
kd_buildTree(struct kd_point *points, unsigned long nPoints,
float *min, float *max, int dim, int max_threads)
kdata_t *min, kdata_t *max, int dim, int max_threads)
{
struct kd_thread_data *my_data;
struct kdNode *tree;
......@@ -108,7 +107,7 @@ kd_buildTree(struct kd_point *points, unsigned long nPoints,
/* Returns 1 if node is a point in the hyperrectangle defined by
minimum and maximum vectors min and max. */
int
kd_isPointInRect(struct kdNode *node, float *min, float *max, int dim)
kd_isPointInRect(struct kdNode *node, kdata_t *min, kdata_t *max, int dim)
{
int i;
......@@ -126,7 +125,7 @@ kd_isPointInRect(struct kdNode *node, float *min, float *max, int dim)
the HR described by the minimum and maximum vectors min and
max. Returns 0 otherwise. */
int
kd_isRectInRect(struct kdNode *node, float *min, float *max, int dim)
kd_isRectInRect(struct kdNode *node, kdata_t *min, kdata_t *max, int dim)
{
int i;
......@@ -144,7 +143,7 @@ kd_isRectInRect(struct kdNode *node, float *min, float *max, int dim)
the minimum and maximum vectors min and max. Returns 0
otherwise. */
int
kd_rectOverlapsRect(struct kdNode *node, float *min, float *max, int dim)
kd_rectOverlapsRect(struct kdNode *node, kdata_t *min, kdata_t *max, int dim)
{
int i;
......@@ -175,7 +174,7 @@ kd_rectOverlapsRect(struct kdNode *node, float *min, float *max, int dim)
* \return Pointer to a priority queue, NULL in case of problems.
*/
struct pqueue *
kd_ortRangeSearch(struct kdNode *node, float *min, float *max, int dim)
kd_ortRangeSearch(struct kdNode *node, kdata_t *min, kdata_t *max, int dim)
{
struct pqueue *res;
uint32_t i;
......@@ -196,7 +195,7 @@ kd_ortRangeSearch(struct kdNode *node, float *min, float *max, int dim)
/* This is the orthogonal range search. Returns 1 if okay, 0 in case
of problems. */
int
kd_doOrtRangeSearch(struct kdNode *node, float *min, float *max,
kd_doOrtRangeSearch(struct kdNode *node, kdata_t *min, kdata_t *max,
int dim, struct pqueue *res)
{
......@@ -243,10 +242,10 @@ kd_doOrtRangeSearch(struct kdNode *node, float *min, float *max,
* neigbor.
*/
struct kdNode *
kd_nearest(struct kdNode *node, float *p, float *max_dist_sq, int dim)
kd_nearest(struct kdNode *node, kdata_t *p, kdata_t *max_dist_sq, int dim)
{
struct kdNode *nearer, *further, *nearest = NULL, *tmp, *tmp_nearest;
float dist_sq, tmp_dist_sq, dx;
kdata_t dist_sq, tmp_dist_sq, dx;
if (!node)
return NULL;
......@@ -271,8 +270,8 @@ kd_nearest(struct kdNode *node, float *p, float *max_dist_sq, int dim)
if (!further)
return nearest;
dx = kd_min(fabs(p[node->split] - further->min[node->split]),
fabs(p[node->split] - further->max[node->split]));
dx = kd_min(KDATA_ABS(p[node->split] - further->min[node->split]),
KDATA_ABS(p[node->split] - further->max[node->split]));
if (*max_dist_sq > kd_sqr(dx)) {
/*
* some part of the further hyper-rectangle is in the search
......@@ -318,8 +317,8 @@ kd_nearest(struct kdNode *node, float *p, float *max_dist_sq, int dim)
* in case of problems.
*/
struct pqueue *
kd_qnearest(struct kdNode *node, float *p,
float *max_dist_sq, unsigned int q, int dim)
kd_qnearest(struct kdNode *node, kdata_t *p,
kdata_t *max_dist_sq, unsigned int q, int dim)
{
struct pqueue *res;
uint32_t i;
......@@ -348,11 +347,11 @@ kd_qnearest(struct kdNode *node, float *p,
*/
// Uwe Schulzweida: extract kd_check_dist() from kd_doQnearest()
static int
kd_check_dist(struct kdNode *node, float *p,
float *max_dist_sq, unsigned int q, int dim, struct pqueue *res)
kd_check_dist(struct kdNode *node, kdata_t *p,
kdata_t *max_dist_sq, unsigned int q, int dim, struct pqueue *res)
{
struct resItem *point, *item;
float dist_sq;
kdata_t dist_sq;
dist_sq = kd_dist_sq(node->location, p, dim);
if (dist_sq < *max_dist_sq && kd_isleaf(node)) {
......@@ -395,11 +394,11 @@ kd_check_dist(struct kdNode *node, float *p,
}
int
kd_doQnearest(struct kdNode *node, float *p,
float *max_dist_sq, unsigned int q, int dim, struct pqueue *res)
kd_doQnearest(struct kdNode *node, kdata_t *p,
kdata_t *max_dist_sq, unsigned int q, int dim, struct pqueue *res)
{
struct kdNode *nearer, *further;
float dx;
kdata_t dx;
if (!node) return 1;
......@@ -416,8 +415,8 @@ kd_doQnearest(struct kdNode *node, float *p,
if (!further) return 1;
dx = kd_min(fabs(p[node->split] - further->min[node->split]),
fabs(p[node->split] - further->max[node->split]));
dx = kd_min(KDATA_ABS(p[node->split] - further->min[node->split]),
KDATA_ABS(p[node->split] - further->max[node->split]));
if (*max_dist_sq > kd_sqr(dx)) {
/*
* some part of the further hyper-rectangle is in the search
......@@ -448,7 +447,7 @@ kd_doQnearest(struct kdNode *node, float *p,
* NULL in case of problems.
*/
struct pqueue *
kd_range(struct kdNode *node, float *p, float *max_dist_sq,
kd_range(struct kdNode *node, kdata_t *p, kdata_t *max_dist_sq,
int dim, int ordered)
{
struct pqueue *res;
......@@ -470,13 +469,13 @@ kd_range(struct kdNode *node, float *p, float *max_dist_sq,
/* This is the range search. Returns 1 if okay, 0 in case of problems */
int
kd_doRange(struct kdNode *node, float *p, float *max_dist_sq,
kd_doRange(struct kdNode *node, kdata_t *p, kdata_t *max_dist_sq,
int dim, struct pqueue *res, int ordered)
{
struct kdNode *nearer, *further;
struct resItem *point;
float dist_sq, dx;
kdata_t dist_sq, dx;
if (!node)
return 1;
......@@ -504,8 +503,8 @@ kd_doRange(struct kdNode *node, float *p, float *max_dist_sq,
if (!further)
return 1;
dx = kd_min(fabs(p[node->split] - further->min[node->split]),
fabs(p[node->split] - further->max[node->split]));
dx = kd_min(KDATA_ABS(p[node->split] - further->min[node->split]),
KDATA_ABS(p[node->split] - further->max[node->split]));
if (*max_dist_sq > kd_sqr(dx)) {
/*
* some part of the further hyper-rectangle is in the search
......
......@@ -27,10 +27,10 @@ kd_malloc(size_t size, const char *msg)
return ptr;
}
float
kd_sqr(float x)
kdata_t
kd_sqr(kdata_t x)
{
return x == 0.0 ? 0.0 : x * x;
return x == 0 ? 0 : x * x;
}
int
......@@ -143,11 +143,11 @@ kd_doBuildTree(void *threadarg)
{
int sortaxis;
unsigned long pivot;
float tmpMinLeft[KD_MAX_DIM], tmpMaxLeft[KD_MAX_DIM], tmpMinRight[KD_MAX_DIM], tmpMaxRight[KD_MAX_DIM];
kdata_t tmpMinLeft[KD_MAX_DIM], tmpMaxLeft[KD_MAX_DIM], tmpMinRight[KD_MAX_DIM], tmpMaxRight[KD_MAX_DIM];
struct kdNode *node;
struct kd_point *points;
unsigned long nPoints;
float *min, *max;
kdata_t *min, *max;
int depth, dim, max_threads;
pthread_t threads[2];
pthread_attr_t attr;
......@@ -189,8 +189,8 @@ kd_doBuildTree(void *threadarg)
if ((node = kd_allocNode(points, pivot, min, max, sortaxis, dim)) == NULL)
return NULL;
memcpy(tmpMinLeft, min, dim * sizeof(float));
memcpy(tmpMaxLeft, max, dim * sizeof(float));
memcpy(tmpMinLeft, min, dim * sizeof(kdata_t));
memcpy(tmpMaxLeft, max, dim * sizeof(kdata_t));
tmpMaxLeft[sortaxis] = node->location[sortaxis];
argleft =
kd_buildArg(points, pivot, tmpMinLeft, tmpMaxLeft,
......@@ -210,8 +210,8 @@ kd_doBuildTree(void *threadarg)
}
}
memcpy(tmpMinRight, min, dim * sizeof(float));
memcpy(tmpMaxRight, max, dim * sizeof(float));
memcpy(tmpMinRight, min, dim * sizeof(kdata_t));
memcpy(tmpMaxRight, max, dim * sizeof(kdata_t));
tmpMinRight[sortaxis] = node->location[sortaxis];
argright = kd_buildArg(&points[pivot], nPoints - pivot,
tmpMinRight, tmpMaxRight, depth + 1,
......@@ -255,7 +255,7 @@ kd_freeNode(kdNode *node)
struct kd_thread_data *
kd_buildArg(struct kd_point *points,
unsigned long nPoints,
float *min, float *max,
kdata_t *min, kdata_t *max,
int depth, int max_threads, int dim)
{
struct kd_thread_data *d;
......@@ -264,8 +264,8 @@ kd_buildArg(struct kd_point *points,
return NULL;
d->points = points;
d->nPoints = nPoints;
memcpy(d->min, min, dim*sizeof(float));
memcpy(d->max, max, dim*sizeof(float));
memcpy(d->min, min, dim*sizeof(kdata_t));
memcpy(d->max, max, dim*sizeof(kdata_t));
d->depth = depth;
d->max_threads = max_threads;
d->dim = dim;
......@@ -275,16 +275,16 @@ kd_buildArg(struct kd_point *points,
struct kdNode *
kd_allocNode(struct kd_point *points, unsigned long pivot,
float *min, float *max, int axis, int dim)
kdata_t *min, kdata_t *max, int axis, int dim)
{
struct kdNode *node;
if ((node = (kdNode *)kd_malloc(sizeof(kdNode), "kd_allocNode (node): ")) == NULL)
return NULL;
node->split = axis;
memcpy(node->location, points[pivot].point, dim * sizeof(float));
memcpy(node->min, min, dim * sizeof(float));
memcpy(node->max, max, dim * sizeof(float));
memcpy(node->location, points[pivot].point, dim * sizeof(kdata_t));
memcpy(node->min, min, dim * sizeof(kdata_t));
memcpy(node->max, max, dim * sizeof(kdata_t));
node->left = node->right = NULL;
node->index = 0;
return node;
......
......@@ -11,11 +11,11 @@
general utility functions
********************************************************************* */
inline float
kd_sph_dist_sq(float *x, float *y)
inline kdata_t
kd_sph_dist_sq(kdata_t *x, kdata_t *y)
{
float ds;
/*float arg;*/
kdata_t ds;
/*kdata_t arg;*/
if (!x || !y)
return -1;
......@@ -29,10 +29,10 @@ kd_sph_dist_sq(float *x, float *y)
return kd_sqr(ds);
}
inline float
kd_sph_dist(float *x, float *y)
inline kdata_t
kd_sph_dist(kdata_t *x, kdata_t *y)
{
float ds;
kdata_t ds;
if (!x || !y)
return -1;
......@@ -42,10 +42,10 @@ kd_sph_dist(float *x, float *y)
return ds;
}
float
kd_sph_bearing(float *p1, float *p2)
kdata_t
kd_sph_bearing(kdata_t *p1, kdata_t *p2)
{
float x, y;
kdata_t x, y;
x = cos(p1[1]) * sin(p2[1]) - sin(p1[1]) * cos(p2[1]) * cos(p2[0] - p1[0]);
y = sin(p2[0] - p1[0]) * cos(p2[1]);
......@@ -62,10 +62,10 @@ kd_sph_bearing(float *p1, float *p2)
*
* \return distance of p3 from the great circle connecting p1 and p2.
*/
float
kd_sph_xtd(float *p1, float *p2, float *p3)
kdata_t
kd_sph_xtd(kdata_t *p1, kdata_t *p2, kdata_t *p3)
{
float d13, theta13, theta12;
kdata_t d13, theta13, theta12;
d13 = kd_sph_dist(p1, p3);
theta13 = kd_sph_bearing(p1, p3);
......@@ -74,12 +74,12 @@ kd_sph_xtd(float *p1, float *p2, float *p3)
}
float
kd_sph_orth_dist(float *p1, float *p2, int split)
kdata_t
kd_sph_orth_dist(kdata_t *p1, kdata_t *p2, int split)
{
float ra2, dec2;
float dx;
kdata_t ra2, dec2;
kdata_t dx;
if (split == 1) {
ra2 = p1[0];
......@@ -129,7 +129,7 @@ kd_sph_orth_dist(float *p1, float *p2, int split)
*/
struct kdNode *
kd_sph_buildTree(struct kd_point *points, unsigned long nPoints,
float *min, float *max, int max_threads)
kdata_t *min, kdata_t *max, int max_threads)
{
struct kd_thread_data *my_data;
struct kdNode *tree;
......@@ -154,7 +154,7 @@ kd_sph_buildTree(struct kd_point *points, unsigned long nPoints,
/* Returns 1 if node is a point in the hyperrectangle defined by
minimum and maximum vectors min and max. */
int
kd_sph_isPointInRect(struct kdNode *node, float *min, float *max)
kd_sph_isPointInRect(struct kdNode *node, kdata_t *min, kdata_t *max)
{
if (node == NULL)
return 0;
......@@ -178,7 +178,7 @@ kd_sph_isPointInRect(struct kdNode *node, float *min, float *max)
the HR described by the minimum and maximum vectors min and
max. Returns 0 otherwise. */
int
kd_sph_isRectInRect(struct kdNode *node, float *min, float *max)
kd_sph_isRectInRect(struct kdNode *node, kdata_t *min, kdata_t *max)
{
if (node == NULL)
return 0;
......@@ -242,7 +242,7 @@ kd_sph_isRectInRect(struct kdNode *node, float *min, float *max)
by the minimum and maximum vectors min and max. Returns 0
otherwise. */
int
kd_sph_rectOverlapsRect(struct kdNode *node, float *min, float *max)
kd_sph_rectOverlapsRect(struct kdNode *node, kdata_t *min, kdata_t *max)
{
if (node == NULL)
return 0;
......@@ -274,7 +274,7 @@ kd_sph_rectOverlapsRect(struct kdNode *node, float *min, float *max)
* Rectangle must not cross the meridian!
*/
struct pqueue *
kd_sph_ortRangeSearch(struct kdNode *node, float *min, float *max)
kd_sph_ortRangeSearch(struct kdNode *node, kdata_t *min, kdata_t *max)
{
struct pqueue *res;
uint32_t i;
......@@ -296,7 +296,7 @@ kd_sph_ortRangeSearch(struct kdNode *node, float *min, float *max)
/* This is the orthogonal range search. Returns 1 if okay, 0 in case
of problems. */
int
kd_sph_doOrtRangeSearch(struct kdNode *node, float *min, float *max,
kd_sph_doOrtRangeSearch(struct kdNode *node, kdata_t *min, kdata_t *max,
struct pqueue *res)
{
......@@ -342,11 +342,11 @@ kd_sph_doOrtRangeSearch(struct kdNode *node, float *min, float *max,
* neigbor.
*/
struct kdNode *
kd_sph_nearest(struct kdNode *node, float *p, float *max_dist_sq)
kd_sph_nearest(struct kdNode *node, kdata_t *p, kdata_t *max_dist_sq)
{
struct kdNode *nearer, *further, *nearest, *tmp, *tmp_nearest;
float dist_sq, tmp_dist_sq, dx;
float p1[2], p2[2];
kdata_t dist_sq, tmp_dist_sq, dx;
kdata_t p1[2], p2[2];