00001 #ifndef KDTREE_COMMON_H_
00002 #define KDTREE_COMMON_H_
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 namespace icp {
00028
00029
00030
00031
00032 #define RETURN_POINTS 101
00033 #define RETURN_INDEX 102
00034
00035
00036
00037
00038
00039 #define EVAL_INDEX(X,Y,L) (reference[ (Y)*(L) +(X)])
00040
00041
00042
00043
00044
00045 typedef struct node {
00046 double *pt;
00047 int orientation;
00048 unsigned int index;
00049 struct node *left, *right;
00050 } Node;
00051
00052
00053
00054
00055 typedef struct tree {
00056 struct node *rootptr;
00057 int dims;
00058 } Tree;
00059
00060
00061
00062
00063
00064
00065 typedef struct timevalg {
00066 long tv_sec;
00067 long tv_usec;
00068 } TV;
00069 typedef struct timezone {
00070 int tz_minuteswest;
00071 int tz_dsttime;
00072 } TZ;
00073
00074
00075
00076 double calcdistance (double *pt1, double *pt2, int Dim);
00077 Node* rangeQuery (Node *v, double distance, double *pt, int D);
00078 Node* pointLocation (Node *v, double *pt, int D);
00079 void display_tree (Node *nodeptr, int D);
00080 void run_queries (Node *pVertex, double *model, int M, int D,
00081 double *closest_pt, double *distance, short ReturnType);
00082 void free_tree (Node *pVertex);
00083 Tree* build_kdtree (double *reference, int N, int D, int *index,
00084 int L, int offset);
00085 Node *build_kdtree_core (double *reference, int N, int D, int *index,
00086 int L, int offset);
00087 void quicksort (int *ra, int p, int r, double *reference,
00088 int offset, int D);
00089 int partition (int *a, int p, int r, double *reference,
00090 int offset, int D);
00091 void run_range_search (Node *pVertex, double *model, int M, int D,
00092 double distlim, double **pts_in_range, unsigned int *L,
00093 unsigned int **indices);
00094 }
00095
00096 #endif