00001 00007 #ifndef _SMP_DISTANCE_EVALUATOR_KDTREE_H_ 00008 #define _SMP_DISTANCE_EVALUATOR_KDTREE_H_ 00009 00010 #include <smp/components/distance_evaluators/base.h> 00011 00012 #include <smp/external_libraries/kdtree/kdtree.h> 00013 00014 00015 namespace smp { 00016 00018 00030 template< class typeparams, int NUM_DIMENSIONS > 00031 class distance_evaluator_kdtree : public distance_evaluator_base<typeparams> { 00032 00033 00034 00035 typedef typename typeparams::state state_t; 00036 typedef typename typeparams::input input_t; 00037 typedef typename typeparams::vertex_data vertex_data_t; 00038 typedef typename typeparams::edge_data edge_data_t; 00039 00040 typedef vertex<typeparams> vertex_t; 00041 typedef edge<typeparams> edge_t; 00042 00043 typedef struct kdtree kdtree_t; 00044 typedef struct kdres kdres_t; 00045 00046 kdtree_t *kdtree; 00047 00048 list<vertex_t*> *list_vertices; 00049 bool vertex_deleted; 00050 00051 double weights[NUM_DIMENSIONS]; 00052 00053 public: 00054 distance_evaluator_kdtree (); 00055 ~distance_evaluator_kdtree (); 00056 00057 00058 int de_update_insert_vertex (vertex_t *vertex_in); 00059 00060 00061 int de_update_insert_edge (edge_t *edge_in); 00062 00063 00064 int de_update_delete_vertex (vertex_t *vertex_in); 00065 00066 00067 int de_update_delete_edge (edge_t *edge_in); 00068 00069 00070 int find_nearest_vertex (state_t *state_in, 00071 void **data_out); 00072 00073 00074 int find_near_vertices_r (state_t *state_in, double radius_in, 00075 list<void *> *list_data_out); 00076 00077 00078 int find_near_vertices_k (state_t *state_in, int k_in, 00079 list<void *> *list_data_out); 00080 00095 int set_list_vertices (list<vertex_t*> *list_vertices_in); 00096 00097 00107 int reconstruct_kdtree_from_vertex_list (); 00108 00120 int set_weights (double weights_in[NUM_DIMENSIONS]); 00121 00122 }; 00123 00124 00125 } 00126 00127 #endif