LEMUR Packages: ompl_lemur or_lemur pr_bgl prpy_lemur
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Groups Pages
NearestNeighborsLinearBGL.h
Go to the documentation of this file.
1 
7 namespace ompl_lemur
8 {
9 
10 template <class Graph, class VState>
12 {
13 public:
14  typedef typename boost::graph_traits<Graph>::vertex_descriptor Vertex;
15  Graph & g;
16  VState state_map;
17  const ompl::base::StateSpacePtr space;
18  NearestNeighborsLinearBGL(Graph & g, VState state_map, const ompl::base::StateSpacePtr space):
19  g(g), state_map(state_map), space(space)
20  {
21  }
22  inline void add(Vertex v_new) {}
23  inline void nearestR(Vertex v_new, double radius, std::vector<Vertex> & vs_near)
24  {
25  vs_near.clear();
26  for (unsigned int ui=0; ui<num_vertices(g); ui++)
27  {
28  Vertex v_other = vertex(ui, g);
29  double dist = this->space->distance(
30  get(state_map, v_new),
31  get(state_map, v_other));
32  if (radius < dist)
33  continue;
34  vs_near.push_back(v_other);
35  }
36  }
37  void sync() {}
38 };
39 
40 } // namespace ompl_lemur
Definition: NearestNeighborsLinearBGL.h:11