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
lvr2::LBKdTree::m_splits
boost::shared_ptr< LBPointArray< unsigned char > > m_splits
Definition: LBKdTree.hpp:73
LBPointArray.hpp
lvr2::LBKdTree::pool
static ctpl::thread_pool * pool
Definition: LBKdTree.hpp:80
lvr2::LBKdTree::getKdTreeSplits
boost::shared_ptr< LBPointArray< unsigned char > > getKdTreeSplits()
Definition: LBKdTree.cpp:91
lvr2::LBKdTree
The LBKdTree class implements a left-balanced array-based index kd-tree. Left-Balanced: minimum memor...
Definition: LBKdTree.hpp:51
ctpl.h
lvr2::LBKdTree::~LBKdTree
~LBKdTree()
Definition: LBKdTree.cpp:54
scripts.create_png.values
values
Definition: create_png.py:26
lvr2::LBKdTree::generateKdTreeRecursive
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
ctpl::thread_pool
Definition: ctpl.h:48
lvr2::LBKdTree::getKdTreeValues
boost::shared_ptr< LBPointArray< float > > getKdTreeValues()
Definition: LBKdTree.cpp:87
lvr2::LBKdTree::LBKdTree
LBKdTree(LBPointArray< float > &vertices, int num_threads=8)
Public.
Definition: LBKdTree.cpp:45
lvr2::LBKdTree::fillCriticalIndicesSet
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
lvr2::LBKdTree::m_values
boost::shared_ptr< LBPointArray< float > > m_values
Definition: LBKdTree.hpp:70
lvr2
Definition: BaseBufferManipulators.hpp:39
lvr2::LBKdTree::test
static void test(int id, LBPointArray< float > *sorted_indices)
lvr2::LBKdTree::generateKdTree
void generateKdTree(LBPointArray< float > &vertices)
Definition: LBKdTree.cpp:61
lvr2::LBPointArray< float >
lvr2::LBKdTree::fillCriticalIndices
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
lvr2::LBKdTree::st_num_threads
static int st_num_threads
Definition: LBKdTree.hpp:77
lvr2::LBKdTree::st_depth_threads
static int st_depth_threads
Definition: LBKdTree.hpp:78
lvr2::LBKdTree::generateKdTreeArray
void generateKdTreeArray(LBPointArray< float > &V, LBPointArray< unsigned int > *sorted_indices, int max_dim)
Private.
Definition: LBKdTree.cpp:97


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:24