SearchTreeFlann.hpp
Go to the documentation of this file.
1 
28 /*
29  * SearchTreeFlann.hpp
30  *
31  * Created on: Sep 22, 2015
32  * Author: Thomas Wiemann
33  */
34 
35 #ifndef LVR2_RECONSTRUCTION_SEARCHTREEFLANN_HPP_
36 #define LVR2_RECONSTRUCTION_SEARCHTREEFLANN_HPP_
37 
38 #include <vector>
39 #include <memory>
40 
41 #include <flann/flann.hpp>
42 
43 #include "lvr2/io/Timestamp.hpp"
44 #include "lvr2/io/PointBuffer.hpp"
46 
47 using std::vector;
48 using std::unique_ptr;
49 
50 namespace lvr2
51 {
52 
59 template<typename BaseVecT>
60 class SearchTreeFlann : public SearchTree<BaseVecT>
61 {
62 private:
63  using CoordT = typename BaseVecT::CoordType;
64 
65 public:
66 
73 
75  virtual int kSearch(
76  const BaseVecT& qp,
77  int k,
78  vector<size_t>& indices,
79  vector<CoordT>& distances
80  ) const override;
81 
83  virtual void radiusSearch(
84  const BaseVecT& qp,
85  CoordT r,
86  vector<size_t>& indices
87  ) const override;
88 
89  void kSearchMany(
90  const BaseVecT* query,
91  int n,
92  int k,
93  size_t* indices,
94  CoordT* distances
95  ) const;
96 
97 protected:
98 
100  unique_ptr<flann::Index<flann::L2_Simple<CoordT>>> m_tree;
101 
102  boost::shared_array<CoordT> m_data;
103 };
104 
105 } // namespace lvr2
106 
107 #include "lvr2/reconstruction/SearchTreeFlann.tcc"
108 
109 #endif /* LVR2_RECONSTRUCTION_SEARCHTREEFLANN_HPP_ */
lvr2::SearchTree::CoordT
typename BaseVecT::CoordType CoordT
Definition: SearchTree.hpp:53
lvr2::PointBufferPtr
std::shared_ptr< PointBuffer > PointBufferPtr
Definition: PointBuffer.hpp:130
SearchTree.hpp
lvr2::SearchTreeFlann::m_data
boost::shared_array< CoordT > m_data
Definition: SearchTreeFlann.hpp:102
lvr2::SearchTreeFlann::kSearchMany
void kSearchMany(const BaseVecT *query, int n, int k, size_t *indices, CoordT *distances) const
PointBuffer.hpp
lvr2::SearchTreeFlann
SearchClass for point data.
Definition: SearchTreeFlann.hpp:60
lvr2::SearchTreeFlann::radiusSearch
virtual void radiusSearch(const BaseVecT &qp, CoordT r, vector< size_t > &indices) const override
See interface documentation.
lvr2::SearchTreeFlann::m_tree
unique_ptr< flann::Index< flann::L2_Simple< CoordT > > > m_tree
The FLANN search tree structure.
Definition: SearchTreeFlann.hpp:100
lvr2
Definition: BaseBufferManipulators.hpp:39
Timestamp.hpp
lvr2::SearchTreeFlann::SearchTreeFlann
SearchTreeFlann(PointBufferPtr buffer)
Takes the point-data and initializes the underlying searchtree.
lvr2::SearchTreeFlann::kSearch
virtual int kSearch(const BaseVecT &qp, int k, vector< size_t > &indices, vector< CoordT > &distances) const override
See interface documentation.
lvr2::SearchTree
Abstract interface for storing and searching through a set of points. Query functions for nearest nei...
Definition: SearchTree.hpp:50


lvr2
Author(s): Thomas Wiemann , Sebastian Pütz , Alexander Mock , Lars Kiesow , Lukas Kalbertodt , Tristan Igelbrink , Johan M. von Behren , Dominik Feldschnieders , Alexander Löhr
autogenerated on Wed Mar 2 2022 00:37:25