supereight
octant_util.hpp
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2016-2019 Emanuele Vespa
3  * SPDX-FileCopyrightText: 2021 Smart Robotics Lab, Imperial College London, Technical University of Munich
4  * SPDX-FileCopyrightText: 2021 Nils Funk
5  * SPDX-FileCopyrightText: 2021 Sotiris Papatheodorou
6  * SPDX-License-Identifier: BSD-3-Clause
7  */
8 
9 #ifndef SE_OCTANT_UTIL_HPP
10 #define SE_OCTANT_UTIL_HPP
11 
12 #include "key_util.hpp"
13 #include "se/common/math_util.hpp"
14 #include "se/map/octant/octant.hpp"
15 
16 
17 namespace se {
18 namespace octantops {
19 
20 
21 
30 template<typename BlockT, se::Sort SortT = se::Sort::SmallToLarge>
31 inline typename std::enable_if_t<SortT == se::Sort::SmallToLarge>
32 sort_blocks(std::vector<se::OctantBase*>& block_ptrs);
33 
42 template<typename BlockT, se::Sort SortT>
43 inline typename std::enable_if_t<SortT == se::Sort::LargeToSmall>
44 sort_blocks(std::vector<se::OctantBase*>& block_ptrs);
45 
46 
47 
54 inline int size_to_scale(const int octant_size);
55 
62 inline int scale_to_size(const int octant_scale);
63 
72 template<typename OctreeT>
73 inline int octant_to_size(const se::OctantBase* octant_ptr);
74 
83 template<typename OctreeT>
84 inline int octant_to_scale(const se::OctantBase* octant_ptr);
85 
94 template<typename OctreeT>
95 inline se::key_t octant_to_key(const se::OctantBase* octant_ptr);
96 
97 
98 
99 } // namespace octantops
100 } // namespace se
101 
102 #include "impl/octant_util_impl.hpp"
103 
104 #endif // SE_OCTANT_UTIL_HPP
int scale_to_size(const int octant_scale)
Convert the scale of a octant to its size in [voxel].
se::key_t octant_to_key(const se::OctantBase *octant_ptr)
Get the octant&#39;s key.
std::enable_if_t< SortT==se::Sort::SmallToLarge > sort_blocks(std::vector< se::OctantBase *> &block_ptrs)
Sort a vector of blocks according to its morton code from small to large.
uint64_t key_t
key = 1 bit buffer + 57 bits of morton code + 6 bits of scale information The maxium scale is limited...
Definition: type_util.hpp:44
int size_to_scale(const int octant_size)
Convert the size of an octant in [voxel] to its scale in the octree.
int octant_to_size(const se::OctantBase *octant_ptr)
Get the octant&#39;s size.
int octant_to_scale(const se::OctantBase *octant_ptr)
Get the octant&#39;s scale.
This class only helps to dynamic cast the octant to the right type and builds the base of nodes and b...
Definition: octant.hpp:24
Helper wrapper to allocate and de-allocate octants in the octree.
Definition: colour_utils.hpp:17