kdtree_common.h
Go to the documentation of this file.
00001 #ifndef KDTREE_COMMON_H_
00002 #define KDTREE_COMMON_H_
00003 // Guy Shechter
00004 // June 2004
00005 // 
00006 // Uncomment one of these includes depending on your architecture.
00007 // Your installation location may vary.
00008 //
00009 //
00010 // For Linux use this line:
00011 //
00012 //#include "/usr/local/matlab/extern/include/mex.h"
00013 //
00014 //
00015 // For Windows systems use this line:
00016 //
00017 //#include "c:\matlab701\extern\include\mex.h"
00018 //#include "mex.h"
00019 //
00020 //
00021 // For Mac Os X systems use this line :
00022 //
00023 //#include "/Applications/MATLAB6p5p1/extern/include/mex.h"
00024 //
00025 //
00026 
00027 namespace icp {
00028 
00029 //
00030 // Some Constants
00031 //
00032 #define RETURN_POINTS 101
00033 #define RETURN_INDEX  102
00034 
00035 //
00036 //  Some Macros to make the code more readable 
00037 //
00038 
00039 #define EVAL_INDEX(X,Y,L) (reference[ (Y)*(L) +(X)])
00040 
00041 
00042 //
00043 //   The definition of a node in the k-d tree.
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 //   The definition of the Tree root node
00054 //
00055 typedef struct tree {
00056   struct node *rootptr;
00057   int dims;
00058 } Tree;
00059 
00060 
00061 
00062 //
00063 // Timing structures used to for debuging purposes
00064 //
00065 typedef struct timevalg {
00066   long    tv_sec;        /* seconds since Jan. 1, 1970 */
00067   long tv_usec;       /* and microseconds */
00068 } TV;
00069 typedef struct timezone {
00070   int  tz_minuteswest;     /* of Greenwich */
00071   int  tz_dsttime;    /* type of dst correction to apply */
00072 } TZ;
00073 
00074 
00075 /* PROTOTYPE DECLARATIONS */
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
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Friends Defines


icp
Author(s): Maintained by Juergen Sturm
autogenerated on Wed Dec 26 2012 15:34:47