Commit 3a4616a6 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

kdtree: set KDATA to KD_DOUBLE.

parent 3cafa0ff
......@@ -22,22 +22,36 @@
#include <stdio.h>
#include <string.h>
#define KD_FLOAT 1
#define KD_INT 2
#define KD_FLOAT 1
#define KD_INT 2
#define KD_DOUBLE 3
#define KD_LONG 4
#define KD_TYPE KD_FLOAT
#define KD_TYPE KD_DOUBLE
//#define KD_TYPE KD_INT
#if KD_TYPE == KD_INT
typedef int kdata_t;
# define KDATA_SFAC 20000.
# define KDATA_SCALE(x) ((int) (0.5+KDATA_SFAC*(x)))
# define KDATA_SFAC 44000.
# define KDATA_SCALE(x) ((int) lround(KDATA_SFAC*(x)))
# define KDATA_INVSCALE(x) ((x)/KDATA_SFAC)
# define KDATA_ABS(x) abs(x)
#else
#elif KD_TYPE == KD_FLOAT
typedef float kdata_t;
# define KDATA_SCALE(x) (x)
# define KDATA_INVSCALE(x) (x)
# define KDATA_ABS(x) fabsf(x)
#elif KD_TYPE == KD_DOUBLE
typedef double kdata_t;
# define KDATA_SCALE(x) (x)
# define KDATA_INVSCALE(x) (x)
# define KDATA_ABS(x) fabs(x)
#elif KD_TYPE == KD_LONG
typedef long kdata_t;
# define KDATA_SFAC 3000000.
# define KDATA_SCALE(x) (lround(KDATA_SFAC*(x)))
# define KDATA_INVSCALE(x) ((x)/KDATA_SFAC)
# define KDATA_ABS(x) labs(x)
#endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment