LBKdTree.hpp
Go to the documentation of this file.
1 
28 #ifndef __LBKDTREE_HPP
29 #define __LBKDTREE_HPP
30 
31 
33 
34 #include <ctpl.h>
35 
36 #include <stdlib.h>
37 #include <math.h>
38 #include <list>
39 #include <unordered_set>
40 
41 #include <boost/shared_ptr.hpp>
42 
43 namespace lvr2
44 {
45 
51 class LBKdTree {
52 public:
53 
54  LBKdTree( LBPointArray<float>& vertices , int num_threads=8);
55 
56  ~LBKdTree();
57 
58  void generateKdTree( LBPointArray<float>& vertices );
59 
60  boost::shared_ptr<LBPointArray<float> > getKdTreeValues();
61 
62  boost::shared_ptr<LBPointArray<unsigned char> > getKdTreeSplits();
63 
64 private:
65 
67  LBPointArray<unsigned int>* sorted_indices,
68  int max_dim);
69 
70  boost::shared_ptr<LBPointArray<float> > m_values;
71 
72  // split dim 4 dims per split_dim
73  boost::shared_ptr<LBPointArray<unsigned char> > m_splits;
74 
75  // Static member
76 
77  static int st_num_threads;
78  static int st_depth_threads;
79 
81 
82  static void fillCriticalIndices(const LBPointArray<float>& V,
83  LBPointArray<unsigned int>& sorted_indices,
84  unsigned int current_dim,
85  float split_value, unsigned int split_index,
86  std::list<unsigned int>& critical_indices_left,
87  std::list<unsigned int>& critical_indices_right);
88 
89  static void fillCriticalIndicesSet(const LBPointArray<float>& V,
90  LBPointArray<unsigned int>& sorted_indices,
91  unsigned int current_dim,
92  float split_value, unsigned int split_index,
93  std::unordered_set<unsigned int>& critical_indices_left,
94  std::unordered_set<unsigned int>& critical_indices_right);
95 
96 
97  static void generateKdTreeRecursive(int id, LBPointArray<float>& V,
98  LBPointArray<unsigned int>* sorted_indices, int current_dim, int max_dim,
100  int size, int max_tree_depth, int position, int current_depth);
101 
102  static void test(int id, LBPointArray<float>* sorted_indices);
103 
104 
105 };
106 
107 } /* namespace lvr2 */
108 
109 #endif // !__LBKDTREE_HPP
static void fillCriticalIndicesSet(const LBPointArray< float > &V, LBPointArray< unsigned int > &sorted_indices, unsigned int current_dim, float split_value, unsigned int split_index, std::unordered_set< unsigned int > &critical_indices_left, std::unordered_set< unsigned int > &critical_indices_right)
Definition: LBKdTree.cpp:183
static ctpl::thread_pool * pool
Definition: LBKdTree.hpp:80
boost::shared_ptr< LBPointArray< unsigned char > > getKdTreeSplits()
Definition: LBKdTree.cpp:91
boost::shared_ptr< LBPointArray< float > > m_values
Definition: LBKdTree.hpp:70
void generateKdTree(LBPointArray< float > &vertices)
Definition: LBKdTree.cpp:61
static int st_num_threads
Definition: LBKdTree.hpp:77
static void fillCriticalIndices(const LBPointArray< float > &V, LBPointArray< unsigned int > &sorted_indices, unsigned int current_dim, float split_value, unsigned int split_index, std::list< unsigned int > &critical_indices_left, std::list< unsigned int > &critical_indices_right)
Definition: LBKdTree.cpp:154
static void generateKdTreeRecursive(int id, LBPointArray< float > &V, LBPointArray< unsigned int > *sorted_indices, int current_dim, int max_dim, LBPointArray< float > *values, LBPointArray< unsigned char > *splits, int size, int max_tree_depth, int position, int current_depth)
Definition: LBKdTree.cpp:213
static int st_depth_threads
Definition: LBKdTree.hpp:78
void generateKdTreeArray(LBPointArray< float > &V, LBPointArray< unsigned int > *sorted_indices, int max_dim)
Private.
Definition: LBKdTree.cpp:97
boost::shared_ptr< LBPointArray< float > > getKdTreeValues()
Definition: LBKdTree.cpp:87
boost::shared_ptr< LBPointArray< unsigned char > > m_splits
Definition: LBKdTree.hpp:73
LBKdTree(LBPointArray< float > &vertices, int num_threads=8)
Public.
Definition: LBKdTree.cpp:45
static void test(int id, LBPointArray< float > *sorted_indices)
The LBKdTree class implements a left-balanced array-based index kd-tree. Left-Balanced: minimum memor...
Definition: LBKdTree.hpp:51


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 Mon Feb 28 2022 22:46:07