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 
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
lvr2::PointOctree::link
void link(BOct *parent, T *child)
BaseVector.hpp
lvr2::PointOctree::~PointOctree
virtual ~PointOctree()
Definition: PointOctree.hpp:42
MemoryHandler.hpp
lvr2::PointOctree::m_lod
unsigned char m_lod
Definition: PointOctree.hpp:53
lvr2::PointOctree::m_root
BOct * m_root
Definition: PointOctree.hpp:46
lvr2::Leaf::m_size
unsigned int m_size
Definition: PointOctree.hpp:27
lvr2::PointBufferPtr
std::shared_ptr< PointBuffer > PointBufferPtr
Definition: PointBuffer.hpp:130
lvr2::Leaf::m_listIndex
unsigned int m_listIndex
Definition: PointOctree.hpp:28
lvr2::Leaf
Definition: PointOctree.hpp:24
NULL
#define NULL
Definition: mydefs.hpp:141
ChunkMemoryHandler
Definition: MemoryHandler.hpp:8
lvr2::PointOctree::intersect
void intersect(double planes[24], std::vector< unsigned int > &indices)
lvr2::PointOctree::m_bbox
BoundingBox< BaseVecT > m_bbox
Definition: PointOctree.hpp:47
lvr2::PointOctree::m_points
FloatChannel m_points
Definition: PointOctree.hpp:49
lvr2::BOct
Definition: BOct.hpp:8
lvr2::PointOctree
Definition: PointOctree.hpp:32
lvr2::PointOctree::getPoints
void getPoints(BOct *oct, std::vector< unsigned int > &indices)
BOct.hpp
lvr2::PointOctree::getBBoxes
void getBBoxes(const BoundingBox< BaseVecT > &bbox, BoundingBox< BaseVecT > *boxes)
lvr2::PointOctree::buildTree
long buildTree(BOct *oct, size_t start, size_t size, const BoundingBox< BaseVecT > &bbox)
lvr2::PointOctree::genDisplayLists
void genDisplayLists()
Definition: PointOctree.hpp:40
PointBuffer.hpp
lvr2::PointOctree::getIndex
unsigned char getIndex(const BaseVecT &point, const BoundingBox< BaseVecT > &bbox)
lvr2::PointOctree::sortPC
void sortPC(size_t start, size_t size, const BoundingBox< BaseVecT > &bbox, size_t bucket_sizes[8])
lvr2::BoundingBox
A dynamic bounding box class.
Definition: BoundingBox.hpp:49
lvr2::PointOctree::getChildPtr
T * getChildPtr(BOct *parent)
lvr2::Channel< float >
lvr2::PointOctree::setLOD
void setLOD(unsigned char lod)
Definition: PointOctree.hpp:38
lvr2
Definition: BaseBufferManipulators.hpp:39
lvr2::PointOctree::m_voxelSize
float m_voxelSize
Definition: PointOctree.hpp:45
lvr2::PointOctree::PointOctree
PointOctree(PointBufferPtr &points, int depth)
lvr2::PointOctree::m_mem
ChunkMemoryHandler m_mem
Definition: PointOctree.hpp:51
BoundingBox.hpp
lvr2::Leaf::m_start
unsigned int m_start
Definition: PointOctree.hpp:26


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