Blue Brain BioExplorer
PointOctree.h
Go to the documentation of this file.
1 /*
2  *
3  * The Blue Brain BioExplorer is a tool for scientists to extract and analyse
4  * scientific data from visualization
5  *
6  * This file is part of Blue Brain BioExplorer <https://github.com/BlueBrain/BioExplorer>
7  *
8  * Copyright 2020-2024 Blue BrainProject / EPFL
9  *
10  * This program is free software: you can redistribute it and/or modify it under
11  * the terms of the GNU General Public License as published by the Free Software
12  * Foundation, either version 3 of the License, or (at your option) any later
13  * version.
14  *
15  * This program is distributed in the hope that it will be useful, but WITHOUT
16  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
18  * details.
19  *
20  * You should have received a copy of the GNU General Public License along with
21  * this program. If not, see <https://www.gnu.org/licenses/>.
22  */
23 
24 #pragma once
25 
27 
28 #include "PointOctreeNode.h"
29 
30 namespace core
31 {
38 {
39 public:
49  PointOctree(const OctreePoints &points, double voxelSize, const Vector3f &minAABB, const Vector3f &maxAABB);
50 
55  ~PointOctree();
56 
62  const Vector3ui &getVolumeDimensions() const { return _volumeDimensions; }
63 
69  uint32_t getVolumeSize() const { return _volumeSize; }
70 
76  uint32_t getOctreeSize() const { return _octreeSize; }
77 
83  uint32_t getOctreeDepth() const { return _depth; }
84 
90  const uint32_ts &getFlatIndices() const { return _flatIndices; }
91 
97  const floats &getFlatData() const { return _flatData; }
98 
99 private:
100  void _flattenChildren(PointOctreeNode *node, uint32_t level);
101 
102  inline uint32_t _pow2roundup(uint32_t x)
103  {
104  --x;
105  x |= x >> 1;
106  x |= x >> 2;
107  x |= x >> 4;
108  x |= x >> 8;
109  x |= x >> 16;
110  return x + 1;
111  }
112 
113  Vector3ui _volumeDimensions;
114  uint32_t _volumeSize;
115  uint32_t _octreeSize;
116  uint32_t _depth;
117 
118  uint32_ts _offsetPerLevel;
119 
120  uint32_ts _flatIndices;
121  floats _flatData;
122 };
123 } // namespace core
The PointOctreeNode class implement a spherical node of the Octree acceleration structure used by the...
The PointOctree class implements the PointOctree acceleration structure used by the FieldsRenderer cl...
Definition: PointOctree.h:38
const floats & getFlatData() const
Get a flattened representation of the PointOctree data (node values)
Definition: PointOctree.h:97
uint32_t getOctreeDepth() const
Get the depth of the PointOctree.
Definition: PointOctree.h:83
uint32_t getVolumeSize() const
Get the size of the volume.
Definition: PointOctree.h:69
const Vector3ui & getVolumeDimensions() const
Get the volume dimentions defined by the scene and the voxel sizes.
Definition: PointOctree.h:62
const uint32_ts & getFlatIndices() const
Get a flattened representation of the PointOctree indices.
Definition: PointOctree.h:90
uint32_t getOctreeSize() const
Get the size of the PointOctree.
Definition: PointOctree.h:76
~PointOctree()
Destroy the PointOctree object.
PointOctree(const OctreePoints &points, double voxelSize, const Vector3f &minAABB, const Vector3f &maxAABB)
Construct a new PointOctree object.
Definition: PointOctree.cpp:33
glm::vec3 Vector3f
Definition: MathTypes.h:137
glm::vec< 3, uint32_t > Vector3ui
Definition: MathTypes.h:134
std::vector< OctreePoint > OctreePoints
Definition: Types.h:433
std::vector< uint32_t > uint32_ts
Definition: Types.h:53
std::vector< float > floats
Definition: Types.h:45