smp::distance_evaluator_kdtree< typeparams, NUM_DIMENSIONS > Class Template Reference

Distance evalutor that employs a kd-tree structure. More...

#include <kdtree.h>

Inheritance diagram for smp::distance_evaluator_kdtree< typeparams, NUM_DIMENSIONS >:
smp::distance_evaluator_base< typeparams >

List of all members.

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.

Detailed Description

template<class typeparams, int NUM_DIMENSIONS>
class smp::distance_evaluator_kdtree< typeparams, NUM_DIMENSIONS >

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.

Examples:

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.


Member Function Documentation

template<class typeparams , int NUM_DIMENSIONS>
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.

Parameters:
edge_inA pointer to deleted edge.
Returns:
Return 1 for success, a non-positive value to indiacate error.

Implements smp::distance_evaluator_base< typeparams >.

template<class typeparams , int NUM_DIMENSIONS>
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.

Parameters:
vertex_inA pointer to deleted vertex.
Returns:
Return 1 if success, a non-positive value to indiacate error.

Implements smp::distance_evaluator_base< typeparams >.

template<class typeparams , int NUM_DIMENSIONS>
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.

Parameters:
edge_inA pointer to the new edge.
Returns:
Return 1 for success, a non-positive value to indiacate error.

Implements smp::distance_evaluator_base< typeparams >.

template<class typeparams , int NUM_DIMENSIONS>
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.

Parameters:
vertex_inA pointer to the new vertex.
Returns:
Return 1 if success, a non-positive value to indiacate error.

Implements smp::distance_evaluator_base< typeparams >.

template<class typeparams , int NUM_DIMENSIONS>
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.

Parameters:
state_inThe query state.
k_inThe number k.
list_data_outData that is associated with each vertex in the near set organized into a list.
Returns:
Returns 1 for success, a non-positive number for failure.

Implements smp::distance_evaluator_base< typeparams >.

template<class typeparams , int NUM_DIMENSIONS>
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.

Parameters:
state_inThe query state.
radius_inThe radius of the ball.
list_data_outData that is associated with each vertex in the near set organized into a list.
Returns:
Returns 1 for success, a non-positive number for failure.

Implements smp::distance_evaluator_base< typeparams >.

template<class typeparams , int NUM_DIMENSIONS>
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.

Parameters:
state_inThe query state.
data_outData that is associated with the nearest vertex (usually this data is basically a pointer to the nearest vertex itself.
Returns:
Returns 1 for success, a non-positive number for failure.

Implements smp::distance_evaluator_base< typeparams >.

template<class typeparams , int NUM_DIMENSIONS>
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.

Returns:
Returns 1 for success, and a non-positive value to indicate error.
template<class typeparams , int NUM_DIMENSIONS>
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.

Parameters:
list_vertices_inA pointer to the list of vertices
Returns:
Returns 1 for success, and a non-positive value to indicate error.
template<class typeparams , int NUM_DIMENSIONS>
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.

Parameters:
weights_inWeight for each dimension.
Returns:
Returns 1 for success, and a non-positive value to indicate error.

The documentation for this class was generated from the following file: