supereight
octant.hpp
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2016-2019 Emanuele Vespa
3  * SPDX-FileCopyrightText: 2019-2021 Smart Robotics Lab, Imperial College London, Technical University of Munich
4  * SPDX-FileCopyrightText: 2019-2021 Nils Funk
5  * SPDX-FileCopyrightText: 2019-2021 Sotiris Papatheodorou
6  * SPDX-License-Identifier: BSD-3-Clause
7  */
8 
9 #ifndef SE_OCTANT_HPP
10 #define SE_OCTANT_HPP
11 
12 #include <iostream>
13 
14 #include "se/common/math_util.hpp"
15 #include "se/map/data.hpp"
18 
19 namespace se {
20 
24 class OctantBase {
25  public:
33  OctantBase(const bool is_block, const Eigen::Vector3i& coord, OctantBase* parent_ptr = nullptr);
34 
40  inline bool isBlock() const
41  {
42  return is_block_;
43  };
44 
50  inline Eigen::Vector3i getCoord() const
51  {
52  return coord_;
53  }
54 
60  inline const se::OctantBase* getParent() const
61  {
62  return parent_ptr_;
63  }
64 
66  {
67  return parent_ptr_;
68  }
69 
77  inline int getTimeStamp() const
78  {
79  return time_stamp_;
80  }
81 
89  inline void setTimeStamp(const int time_stamp)
90  {
91  time_stamp_ = time_stamp;
92  }
93 
99  inline bool getActive() const
100  {
101  return is_active_;
102  }
103 
109  inline void setActive(bool is_active)
110  {
111  is_active_ = is_active;
112  }
113 
114  inline unsigned int getChildrenMask() const
115  {
116  return children_mask_;
117  }
118 
124  inline void clearChildrenMask()
125  {
126  children_mask_ = 0;
127  }
128 
129  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
130 
131  protected:
132  const bool is_block_;
134  const Eigen::Vector3i coord_;
136  bool is_active_;
137  unsigned int children_mask_;
138 
139  template<typename DerT, typename DatT, int BS>
140  friend class BlockSingleRes;
141 
142  template<typename DatT, int BS, typename DerT>
143  friend class BlockMultiRes;
144 
145  template<typename DatT, typename DerT>
146  friend class NodeMultiRes;
147 };
148 
149 
150 
151 } // namespace se
152 
153 
154 #include "block.hpp"
155 #include "node.hpp"
156 
157 #endif // SE_OCTANT_HPP
const se::OctantBase * getParent() const
Get the parent pointer of the octant.
Definition: octant.hpp:60
int getTimeStamp() const
Get the time stamp of an octant.
Definition: octant.hpp:77
void setActive(bool is_active)
Set the active state of an octant.
Definition: octant.hpp:109
The base used for single-resolution blocks.
Definition: block.hpp:26
Definition: block.hpp:75
void clearChildrenMask()
Clear the children mask.
Definition: octant.hpp:124
const Eigen::Vector3i coord_
The coordinates of the block (left, front , bottom corner)
Definition: octant.hpp:134
OctantBase(const bool is_block, const Eigen::Vector3i &coord, OctantBase *parent_ptr=nullptr)
Setup a octant via its parent.
OctantBase * parent_ptr_
Every node/block (other than root) needs a parent.
Definition: octant.hpp:133
unsigned int getChildrenMask() const
Definition: octant.hpp:114
unsigned int children_mask_
The allocated children.
Definition: octant.hpp:137
void setTimeStamp(const int time_stamp)
Set the time stamp of an octant.
Definition: octant.hpp:89
bool isBlock() const
Verify if an octant is a block.
Definition: octant.hpp:40
const bool is_block_
Definition: octant.hpp:132
se::OctantBase * getParent()
Definition: octant.hpp:65
Definition: node.hpp:35
int time_stamp_
The frame of the last update.
Definition: octant.hpp:135
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
bool is_active_
The active state of the octant.
Definition: octant.hpp:136
Eigen::Vector3i getCoord() const
Get the voxel coordinates of the octant.
Definition: octant.hpp:50
Helper wrapper to allocate and de-allocate octants in the octree.
Definition: colour_utils.hpp:17
bool getActive() const
Get the active state of an octant.
Definition: octant.hpp:99