PointOctree.hpp
Go to the documentation of this file.
1 #ifndef POINT_OCTREE
2 #define POINT_OCTREE
3 
4 #include <vector>
5 
7 #include "lvr2/display/BOct.hpp"
10 
12 
13 namespace lvr2
14 {
15 
16 // struct BOct
17 // {
18 // long m_child : 48;
19 // unsigned char m_valid : 8;
20 // unsigned char m_leaf : 8;
21 // BOct(): m_child(0), m_valid(0), m_leaf(0){}
22 // };
23 
24  struct Leaf
25  {
26  unsigned int m_start;
27  unsigned int m_size;
28  unsigned int m_listIndex;
29  };
30 
31  template <typename BaseVecT>
33  {
34  public:
35  PointOctree(PointBufferPtr& points, int depth);
36 
37  void intersect(double planes[24], std::vector<unsigned int>& indices);
38  void setLOD(unsigned char lod) { m_lod = lod; }
39 
40  void genDisplayLists() { genDisplayLists(m_root); }
41 
42  virtual ~PointOctree() { m_root = NULL; }
43 
44  private:
45  float m_voxelSize;
48  // needs [] operator and has to be strict linear in memory
50 
52 
53  unsigned char m_lod;
54 
55  template <typename T>
56  void link(BOct* parent, T* child);
57 
58  template <typename T>
59  T* getChildPtr(BOct* parent);
60 
61  unsigned char getIndex(const BaseVecT& point, const BoundingBox<BaseVecT>& bbox);
62 
63  void getBBoxes(const BoundingBox<BaseVecT>& bbox, BoundingBox<BaseVecT>* boxes);
64 
65  template <typename PtrT>
66  void sortPC(size_t start, size_t size, const BoundingBox<BaseVecT>& bbox, size_t bucket_sizes[8]);
67 
68  long buildTree(BOct* oct, size_t start, size_t size, const BoundingBox<BaseVecT>& bbox);
69 
70  void getPoints(BOct* oct, std::vector<unsigned int >& indices);
71 
72  void intersect(Leaf* leaf, const BoundingBox<BaseVecT>& bbox, double planes[24], std::vector<unsigned int>& indices);
73 
74  void intersect(BOct* oct, const BoundingBox<BaseVecT>& bbox, double planes[24], std::vector<unsigned int>& indices);
75 
76  void genDisplayLists(Leaf* leaf);
77 
78  void genDisplayLists(BOct* oct);
79 
80 
81 
82 // void colorAndWrite(BOct* oct);
83 //
84 // void colorAndWrite(BOct* oct, unsigned char index);
85 //
86 // void writeLeaf(Leaf* leaf, unsigned char index);
87 
88  // void intersect(BOct* oct, const BoundingBox<BaseVecT>& octBBox, const BoundingBox<BaseVecT>& cullBBox, std::vector<BaseVecT >& pts);
89 
90  // void intersect(const BoundingBox<BaseVecT>& cullBBox, std::vector<BaseVecT >& pts);
91 
92 
93  };
94 }
95 
96 #include "lvr2/display/PointOctree.tcc"
97 
98 #endif
unsigned char m_lod
Definition: PointOctree.hpp:53
std::shared_ptr< PointBuffer > PointBufferPtr
A dynamic bounding box class.
Definition: BoundingBox.hpp:49
unsigned int m_start
Definition: PointOctree.hpp:26
unsigned int m_listIndex
Definition: PointOctree.hpp:28
ChunkMemoryHandler m_mem
Definition: PointOctree.hpp:51
BoundingBox< BaseVecT > m_bbox
Definition: PointOctree.hpp:47
FloatChannel m_points
Definition: PointOctree.hpp:49
void setLOD(unsigned char lod)
Definition: PointOctree.hpp:38
virtual ~PointOctree()
Definition: PointOctree.hpp:42
#define NULL
Definition: mydefs.hpp:141
unsigned int m_size
Definition: PointOctree.hpp:27


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