supereight
Public Types | Public Member Functions | Static Public Attributes | List of all members
se::Octree< DataT, ResT, BlockSize > Class Template Reference

The octree is the memory manager of the map. More...

#include <octree.hpp>

Public Types

typedef std::shared_ptr< Octree< DataT, ResT, BlockSize > > Ptr
 
typedef DataT DataType
 
typedef Node< DataT, ResT > NodeType
 
typedef Block< DataT, ResT, BlockSize > BlockType
 
typedef se::BoostMemoryPool< NodeType, BlockTypeMemoryPool
 

Public Member Functions

 Octree (const int size)
 The octree needs to be initialised during the allocation. More...
 
 ~Octree ()
 
 Octree (const Octree &)=delete
 TODO: More...
 
Octreeoperator= (const Octree &)=delete
 Delete copy assignment operator. More...
 
OctreeIterator< Octree< DataT, ResT, BlockSize > > begin ()
 
OctreeIterator< Octree< DataT, ResT, BlockSize > > end ()
 
bool contains (const Eigen::Vector3i &voxel_coord) const
 Verify if the voxel coordinates are contained in the octree. More...
 
se::OctantBasegetRoot ()
 Get the node pointer to the root of the octree. More...
 
se::OctantBasegetRoot () const
 Get the node pointer to the root of the octree. More...
 
int getSize () const
 Get the size of the octree in [voxel] units. More...
 
int getMaxScale () const
 Get the maximum scale of the octree. More...
 
int getBlockDepth () const
 Get the octree depth the blocks are allocated at. More...
 
bool allocate (NodeType *parent_ptr, const int child_idx, se::OctantBase *&child_ptr)
 Allocate a node for a given parent node. More...
 
se::OctantBaseallocate (NodeType *parent_ptr, const int child_idx)
 Allocate a octant for a given parent node. More...
 
bool allocateAll (NodeType *parent_ptr, const int child_idx, se::OctantBase *&child_ptr)
 Allocate all of the parent node's child octants. More...
 
se::OctantBaseallocateAll (NodeType *parent_ptr, const int child_idx)
 Allocate all of the parent node's child octants. More...
 
void deleteChildren (NodeType *parent_ptr)
 Recursively delete all children of a given node pointer. More...
 

Static Public Attributes

static constexpr unsigned int block_size = BlockSize
 
static constexpr se::scale_t max_block_scale = math::log2_const(BlockSize)
 
static constexpr se::Field fld_ = DataT::fld_
 
static constexpr se::Colour col_ = DataT::col_
 
static constexpr se::Semantics sem_ = DataT::sem_
 
static constexpr se::Res res_ = ResT
 

Detailed Description

template<typename DataT, Res ResT = Res::Single, int BlockSize = 8>
class se::Octree< DataT, ResT, BlockSize >

The octree is the memory manager of the map.

It is the only entity that is able to allocate and deallocate nodes and blocks. However it is not responsible to process the data in the nodes.

Template Parameters
DataTThe data struct stored in each voxel (or node for Res::Multi)
ResTThe resolution type (Res::Single, Res::Multi) defining if data can only stored at a finest scale or any scale.
BlockSizeThe size in voxels of a block. BlockSize in [1, (octree size) / 2] Must be a power of two.

Member Typedef Documentation

◆ Ptr

template<typename DataT , Res ResT = Res::Single, int BlockSize = 8>
typedef std::shared_ptr<Octree<DataT, ResT, BlockSize> > se::Octree< DataT, ResT, BlockSize >::Ptr

◆ DataType

template<typename DataT , Res ResT = Res::Single, int BlockSize = 8>
typedef DataT se::Octree< DataT, ResT, BlockSize >::DataType

◆ NodeType

template<typename DataT , Res ResT = Res::Single, int BlockSize = 8>
typedef Node<DataT, ResT> se::Octree< DataT, ResT, BlockSize >::NodeType

◆ BlockType

template<typename DataT , Res ResT = Res::Single, int BlockSize = 8>
typedef Block<DataT, ResT, BlockSize> se::Octree< DataT, ResT, BlockSize >::BlockType

◆ MemoryPool

template<typename DataT , Res ResT = Res::Single, int BlockSize = 8>
typedef se::BoostMemoryPool<NodeType, BlockType> se::Octree< DataT, ResT, BlockSize >::MemoryPool

Constructor & Destructor Documentation

◆ Octree() [1/2]

template<typename DataT , Res ResT = Res::Single, int BlockSize = 8>
se::Octree< DataT, ResT, BlockSize >::Octree ( const int  size)

The octree needs to be initialised during the allocation.

Parameters
[in]sizeThe size in [voxel] of the octree

◆ ~Octree()

template<typename DataT , Res ResT = Res::Single, int BlockSize = 8>
se::Octree< DataT, ResT, BlockSize >::~Octree ( )
inline

◆ Octree() [2/2]

template<typename DataT , Res ResT = Res::Single, int BlockSize = 8>
se::Octree< DataT, ResT, BlockSize >::Octree ( const Octree< DataT, ResT, BlockSize > &  )
delete

TODO:

Delete copy constructor

Member Function Documentation

◆ operator=()

template<typename DataT , Res ResT = Res::Single, int BlockSize = 8>
Octree& se::Octree< DataT, ResT, BlockSize >::operator= ( const Octree< DataT, ResT, BlockSize > &  )
delete

Delete copy assignment operator.

◆ begin()

template<typename DataT , Res ResT = Res::Single, int BlockSize = 8>
OctreeIterator<Octree<DataT, ResT, BlockSize> > se::Octree< DataT, ResT, BlockSize >::begin ( )

◆ end()

template<typename DataT , Res ResT = Res::Single, int BlockSize = 8>
OctreeIterator<Octree<DataT, ResT, BlockSize> > se::Octree< DataT, ResT, BlockSize >::end ( )

◆ contains()

template<typename DataT , Res ResT = Res::Single, int BlockSize = 8>
bool se::Octree< DataT, ResT, BlockSize >::contains ( const Eigen::Vector3i &  voxel_coord) const
inline

Verify if the voxel coordinates are contained in the octree.

Parameters
[in]voxel_coordThe voxel coordinates to be verified
Returns
True if contained in the octree, False otherwise

◆ getRoot() [1/2]

template<typename DataT , Res ResT = Res::Single, int BlockSize = 8>
se::OctantBase* se::Octree< DataT, ResT, BlockSize >::getRoot ( )
inline

Get the node pointer to the root of the octree.

Returns
The pointer to the root of the octree

◆ getRoot() [2/2]

template<typename DataT , Res ResT = Res::Single, int BlockSize = 8>
se::OctantBase* se::Octree< DataT, ResT, BlockSize >::getRoot ( ) const
inline

Get the node pointer to the root of the octree.

Returns
The pointer to the root of the octree

◆ getSize()

template<typename DataT , Res ResT = Res::Single, int BlockSize = 8>
int se::Octree< DataT, ResT, BlockSize >::getSize ( ) const
inline

Get the size of the octree in [voxel] units.

Returns
The size of the octree

◆ getMaxScale()

template<typename DataT , Res ResT = Res::Single, int BlockSize = 8>
int se::Octree< DataT, ResT, BlockSize >::getMaxScale ( ) const
inline

Get the maximum scale of the octree.

This is equivalent to the scale of the root.

Returns
The max scale of the octree

◆ getBlockDepth()

template<typename DataT , Res ResT = Res::Single, int BlockSize = 8>
int se::Octree< DataT, ResT, BlockSize >::getBlockDepth ( ) const
inline

Get the octree depth the blocks are allocated at.

Returns
The octree depth the blocks are allocated at

◆ allocate() [1/2]

template<typename DataT , Res ResT = Res::Single, int BlockSize = 8>
bool se::Octree< DataT, ResT, BlockSize >::allocate ( NodeType parent_ptr,
const int  child_idx,
se::OctantBase *&  child_ptr 
)
inline

Allocate a node for a given parent node.

Warning
The returned pointer is of type OctantBase as child might be a node or block.
This function might be dangerous when using Multires Occupancy. Preferably use the allocateAll(...) function if unsure.
Parameters
[in]parent_ptrThe parent of the octant to be allocated
[in]child_idxThe child index of the octant to be allocated
[out]child_ptrThe pointer ot the allocated /fetched octant
Returns
Ture if the node has been newly allocated, False if it has already been allocatedAllocate child

◆ allocate() [2/2]

template<typename DataT , Res ResT = Res::Single, int BlockSize = 8>
se::OctantBase* se::Octree< DataT, ResT, BlockSize >::allocate ( NodeType parent_ptr,
const int  child_idx 
)
inline

Allocate a octant for a given parent node.

Warning
The returned pointer is of type OctantBase as child might be a node or block.
This function might be dangerous when using Multires Occupancy. Preferably use the allocateAll(...) function if unsure.
Parameters
[in]parent_ptrThe parent of the octant to be allocated
[in]child_idxThe child index of the octant to be allocated
Returns
The pointer ot the allocated / fetched octant

◆ allocateAll() [1/2]

template<typename DataT , Res ResT = Res::Single, int BlockSize = 8>
bool se::Octree< DataT, ResT, BlockSize >::allocateAll ( NodeType parent_ptr,
const int  child_idx,
se::OctantBase *&  child_ptr 
)
inline

Allocate all of the parent node's child octants.

Warning
The returned pointer is of type OctantBase as child might be a node or block.
Parameters
[in]parent_ptrThe parent of the octants to be allocated
[in]child_idxThe child index of the octant to be returned
[out]child_ptrThe pointer ot the allocated / fetched octant of the child_idx
Returns
Ture if the node has been newly allocated, False if it has already been allocatedAllocate child

◆ allocateAll() [2/2]

template<typename DataT , Res ResT = Res::Single, int BlockSize = 8>
se::OctantBase* se::Octree< DataT, ResT, BlockSize >::allocateAll ( NodeType parent_ptr,
const int  child_idx 
)
inline

Allocate all of the parent node's child octants.

Warning
The returned pointer is of type OctantBase as child might be a node or block.
Parameters
[in]parent_ptrThe parent of the octants to be allocated
[in]child_idxThe child index of the octant to be returned
[out]child_ptrThe pointer ot the allocated octant
Returns
The pointer ot the allocated / fetched octant of the child_idx

◆ deleteChildren()

template<typename DataT , Res ResT = Res::Single, int BlockSize = 8>
void se::Octree< DataT, ResT, BlockSize >::deleteChildren ( NodeType parent_ptr)
inline

Recursively delete all children of a given node pointer.

Parameters
[in]parent_ptrThe node pointer to delete the children of

Member Data Documentation

◆ block_size

template<typename DataT , Res ResT = Res::Single, int BlockSize = 8>
constexpr unsigned int se::Octree< DataT, ResT, BlockSize >::block_size = BlockSize
static

◆ max_block_scale

template<typename DataT , Res ResT = Res::Single, int BlockSize = 8>
constexpr se::scale_t se::Octree< DataT, ResT, BlockSize >::max_block_scale = math::log2_const(BlockSize)
static

◆ fld_

template<typename DataT , Res ResT = Res::Single, int BlockSize = 8>
constexpr se::Field se::Octree< DataT, ResT, BlockSize >::fld_ = DataT::fld_
static

◆ col_

template<typename DataT , Res ResT = Res::Single, int BlockSize = 8>
constexpr se::Colour se::Octree< DataT, ResT, BlockSize >::col_ = DataT::col_
static

◆ sem_

template<typename DataT , Res ResT = Res::Single, int BlockSize = 8>
constexpr se::Semantics se::Octree< DataT, ResT, BlockSize >::sem_ = DataT::sem_
static

◆ res_

template<typename DataT , Res ResT = Res::Single, int BlockSize = 8>
constexpr se::Res se::Octree< DataT, ResT, BlockSize >::res_ = ResT
static

The documentation for this class was generated from the following file: