Distance evalutor that employs a kd-tree structure. More...
#include <kdtree.h>
Public Member Functions | |
int | de_update_insert_vertex (vertex_t *vertex_in) |
Update function for vertex insertion. | |
int | de_update_insert_edge (edge_t *edge_in) |
Update function for edge insertion. | |
int | de_update_delete_vertex (vertex_t *vertex_in) |
Update function for vertex deletion. | |
int | de_update_delete_edge (edge_t *edge_in) |
Update function for edge insertion. | |
int | find_nearest_vertex (state_t *state_in, void **data_out) |
Abstract function that provides the nearest vertex. | |
int | find_near_vertices_r (state_t *state_in, double radius_in, list< void * > *list_data_out) |
Abstract function that provides the set of near vertices within a certain ball. | |
int | find_near_vertices_k (state_t *state_in, int k_in, list< void * > *list_data_out) |
Abstract function that provides the set of near vertices that are the k nearest to the query state. | |
int | set_list_vertices (list< vertex_t * > *list_vertices_in) |
Sets the list of vertices used to rebuild the kdtree. | |
int | reconstruct_kdtree_from_vertex_list () |
Reconstructs the tree from its vertex list. | |
int | set_weights (double weights_in[NUM_DIMENSIONS]) |
Sets the weights in the kdtree. |
Distance evalutor that employs a kd-tree structure.
This class implements a distance evaluator by storing the states in the Euclidean space in a kd-tree structure. It implements nearest neighbor computation and the computation of near states that reside in a ball of given radius. However, it does NOT implement the k-nearest states.
Note that the class has an initialization function which must be called with an appropriate argument, before any other method of the class can be called.
libbot_rrg_double_integrator.cpp, libbot_rrg_dubins_car.cpp, libbot_rrg_dubins_double_integrator_airplane.cpp, libbot_rrg_single_integrator.cpp, libbot_rrg_single_integrator_mu_calculus.cpp, libbot_rrt_double_integrator.cpp, libbot_rrt_dubins_car.cpp, libbot_rrt_dubins_double_integrator_airplane.cpp, libbot_rrt_single_integrator.cpp, libbot_rrtstar_double_integrator.cpp, libbot_rrtstar_dubins_car.cpp, libbot_rrtstar_dubins_double_integrator_airplane.cpp, libbot_rrtstar_single_integrator.cpp, libbot_rrtstar_single_integrator_halton.cpp, libbot_rrtstar_single_integrator_trajectory_biasing.cpp, libbot_rrtstar_single_integrator_trajectory_biasing_and_bnb.cpp, standalone_rrg_double_integrator.cpp, standalone_rrg_dubins_car.cpp, standalone_rrg_dubins_double_integrator_airplane.cpp, standalone_rrg_single_integrator.cpp, standalone_rrg_single_integrator_mu_calculus.cpp, standalone_rrt_double_integrator.cpp, standalone_rrt_dubins_car.cpp, standalone_rrt_dubins_double_integrator_airplane.cpp, standalone_rrt_single_integrator.cpp, standalone_rrtstar_double_integrator.cpp, standalone_rrtstar_dubins_car.cpp, standalone_rrtstar_dubins_double_integrator_airplane.cpp, standalone_rrtstar_single_integrator.cpp, standalone_rrtstar_single_integrator_halton.cpp, standalone_rrtstar_single_integrator_trajectory_biasing.cpp, and standalone_rrtstar_single_integrator_trajectory_biasing_and_bnb.cpp.
int smp::distance_evaluator_kdtree< typeparams, NUM_DIMENSIONS >::de_update_delete_edge | ( | edge_t * | edge_in | ) | [virtual] |
Update function for edge insertion.
This function is called by the planner whenever an edge is delete from the graph. A pointer to the edge is given as an argument.
edge_in | A pointer to deleted edge. |
Implements smp::distance_evaluator_base< typeparams >.
int smp::distance_evaluator_kdtree< typeparams, NUM_DIMENSIONS >::de_update_delete_vertex | ( | vertex_t * | vertex_in | ) | [virtual] |
Update function for vertex deletion.
This function is called by the planner whenever a vertex is deleted from the graph. A pointer to the vertex is given as an argument.
vertex_in | A pointer to deleted vertex. |
Implements smp::distance_evaluator_base< typeparams >.
int smp::distance_evaluator_kdtree< typeparams, NUM_DIMENSIONS >::de_update_insert_edge | ( | edge_t * | edge_in | ) | [virtual] |
Update function for edge insertion.
This function is called by the planner whenever a new edge is added to the graph. A pointer to the new edge is given as an argument.
edge_in | A pointer to the new edge. |
Implements smp::distance_evaluator_base< typeparams >.
int smp::distance_evaluator_kdtree< typeparams, NUM_DIMENSIONS >::de_update_insert_vertex | ( | vertex_t * | vertex_in | ) | [virtual] |
Update function for vertex insertion.
This function is called by the planner whenever a new vertex is added to the graph. A pointer to the new vertex is given as an argument.
vertex_in | A pointer to the new vertex. |
Implements smp::distance_evaluator_base< typeparams >.
int smp::distance_evaluator_kdtree< typeparams, NUM_DIMENSIONS >::find_near_vertices_k | ( | state_t * | state_in, |
int | k_in, | ||
list< void * > * | list_data_out | ||
) | [virtual] |
Abstract function that provides the set of near vertices that are the k nearest to the query state.
Returns the set of k-nearest vertices to the query state.
state_in | The query state. |
k_in | The number k. |
list_data_out | Data that is associated with each vertex in the near set organized into a list. |
Implements smp::distance_evaluator_base< typeparams >.
int smp::distance_evaluator_kdtree< typeparams, NUM_DIMENSIONS >::find_near_vertices_r | ( | state_t * | state_in, |
double | radius_in, | ||
list< void * > * | list_data_out | ||
) | [virtual] |
Abstract function that provides the set of near vertices within a certain ball.
Returns the set of all vertices that lie within the Euclidean ball of radius given by the radius_in argument and centered at the state given by the state_in argument.
state_in | The query state. |
radius_in | The radius of the ball. |
list_data_out | Data that is associated with each vertex in the near set organized into a list. |
Implements smp::distance_evaluator_base< typeparams >.
int smp::distance_evaluator_kdtree< typeparams, NUM_DIMENSIONS >::find_nearest_vertex | ( | state_t * | state_in, |
void ** | data_out | ||
) | [virtual] |
Abstract function that provides the nearest vertex.
Returns the vertex with state that is closest to the query state given by the state_in argument. The data associated with the nearest vertex is output with the data_out argument.
state_in | The query state. |
data_out | Data that is associated with the nearest vertex (usually this data is basically a pointer to the nearest vertex itself. |
Implements smp::distance_evaluator_base< typeparams >.
int smp::distance_evaluator_kdtree< typeparams, NUM_DIMENSIONS >::reconstruct_kdtree_from_vertex_list | ( | ) |
Reconstructs the tree from its vertex list.
This method clears all the points in the kdtree and then calls the de_update_insert_vertex method of this class for each vertex in the vertex list initialized using the set_list_vertices method of this class.
int smp::distance_evaluator_kdtree< typeparams, NUM_DIMENSIONS >::set_list_vertices | ( | list< vertex_t * > * | list_vertices_in | ) |
Sets the list of vertices used to rebuild the kdtree.
If the user desires to rebuild the kdtree from a list vertices. The appropriate list of vertices can be initiliazsed using this function and the reconstruct_kdtree_from_vertex_list method of this class can be called to rebuild the tree. The distance_kdtree class also reconstructs the tree whenever a vertex is deleted. For the reconstruction to succeed, this method must be called a priori.
list_vertices_in | A pointer to the list of vertices |
int smp::distance_evaluator_kdtree< typeparams, NUM_DIMENSIONS >::set_weights | ( | double | weights_in[NUM_DIMENSIONS] | ) |
Sets the weights in the kdtree.
The kdtree structure stores the vertices of the kdtree in an Euclidean space, each axis of which is scaled with certain weights. This function can be used to set those weights. By default, all weights are set to one.
weights_in | Weight for each dimension. |