EasyNav Plugins
Loading...
Searching...
No Matches
VoxelGrid< DataT > Class Template Reference

#include <bonxai.hpp>

Classes

class  Accessor
 Class to be used to set and get values of a cell of the Grid. More...
class  ConstAccessor

Public Types

using InnerGrid = Grid<std::shared_ptr<LeafGrid>>
using LeafGrid = Grid<DataT>
using RootMap = std::unordered_map<CoordT, InnerGrid>

Public Member Functions

size_t activeCellsCount () const
 Return the total number of active cells.
std::shared_ptr< LeafGridallocateLeafGrid ()
void clear (ClearOption opt)
Point3D coordToPos (const CoordT &coord) const
 coordToPos converts CoordT indices to Point3D.
Accessor createAccessor ()
ConstAccessor createConstAccessor () const
template<class VisitorFunction>
void forEachCell (VisitorFunction func)
 forEachCell apply a function of type:
template<class VisitorFunction>
void forEachCell (VisitorFunction func) const
 forEachCell apply a function of type:
uint32_t getInnerIndex (const CoordT &coord) const
CoordT getInnerKey (const CoordT &coord) const
uint32_t getLeafIndex (const CoordT &coord) const
CoordT getRootKey (const CoordT &coord) const
uint32_t innetBits () const
uint32_t leafBits () const
size_t memUsage () const
 getMemoryUsage returns the amount of bytes used by this data structure
VoxelGridoperator= (const VoxelGrid &)=delete
VoxelGridoperator= (VoxelGrid &&other)=default
CoordT posToCoord (const Point3D &pos) const
 posToCoord is used to convert real coordinates to CoordT indices.
CoordT posToCoord (double x, double y, double z) const
 posToCoord is used to convert real coordinates to CoordT indices.
void releaseUnusedMemory ()
 Try freeing memory; this will discard grids where all the cells are OFF.
RootMaprootMap ()
const RootMaprootMap () const
 VoxelGrid (const VoxelGrid &)=delete
 VoxelGrid (double voxel_size, uint8_t inner_bits=2, uint8_t leaf_bits=3)
 VoxelGrid constructor.
 VoxelGrid (VoxelGrid &&other)=default
double voxelSize () const

Member Typedef Documentation

◆ InnerGrid

template<typename DataT>
using InnerGrid = Grid<std::shared_ptr<LeafGrid>>

◆ LeafGrid

template<typename DataT>
using LeafGrid = Grid<DataT>

◆ RootMap

template<typename DataT>
using RootMap = std::unordered_map<CoordT, InnerGrid>

Constructor & Destructor Documentation

◆ VoxelGrid() [1/3]

template<typename DataT>
VoxelGrid ( double voxel_size,
uint8_t inner_bits = 2,
uint8_t leaf_bits = 3 )
explicit

VoxelGrid constructor.

Parameters
voxel_sizedimension of the voxel. Used to convert between Point3D and CoordT

◆ VoxelGrid() [2/3]

template<typename DataT>
VoxelGrid ( const VoxelGrid< DataT > & )
delete

◆ VoxelGrid() [3/3]

template<typename DataT>
VoxelGrid ( VoxelGrid< DataT > && other)
default

Member Function Documentation

◆ activeCellsCount()

template<typename DataT>
size_t activeCellsCount ( ) const
nodiscard

Return the total number of active cells.

◆ allocateLeafGrid()

template<typename DataT>
std::shared_ptr< Grid< DataT > > allocateLeafGrid ( )

◆ clear()

template<typename DataT>
void clear ( ClearOption opt)

◆ coordToPos()

template<typename DataT>
Point3D coordToPos ( const CoordT & coord) const
nodiscard

coordToPos converts CoordT indices to Point3D.

◆ createAccessor()

template<typename DataT>
Accessor createAccessor ( )

◆ createConstAccessor()

template<typename DataT>
ConstAccessor createConstAccessor ( ) const

◆ forEachCell() [1/2]

template<typename DataT>
template<class VisitorFunction>
void forEachCell ( VisitorFunction func)

forEachCell apply a function of type:

void(DataT&, const CoordT&)

to each active element of the grid.

◆ forEachCell() [2/2]

template<typename DataT>
template<class VisitorFunction>
void forEachCell ( VisitorFunction func) const

forEachCell apply a function of type:

void(const DataT&, const CoordT&)

to each active element of the grid.

◆ getInnerIndex()

template<typename DataT>
uint32_t getInnerIndex ( const CoordT & coord) const
nodiscard

◆ getInnerKey()

template<typename DataT>
CoordT getInnerKey ( const CoordT & coord) const
nodiscard

◆ getLeafIndex()

template<typename DataT>
uint32_t getLeafIndex ( const CoordT & coord) const
nodiscard

◆ getRootKey()

template<typename DataT>
CoordT getRootKey ( const CoordT & coord) const
nodiscard

◆ innetBits()

template<typename DataT>
uint32_t innetBits ( ) const

◆ leafBits()

template<typename DataT>
uint32_t leafBits ( ) const

◆ memUsage()

template<typename DataT>
size_t memUsage ( ) const
nodiscard

getMemoryUsage returns the amount of bytes used by this data structure

◆ operator=() [1/2]

template<typename DataT>
VoxelGrid & operator= ( const VoxelGrid< DataT > & )
delete

◆ operator=() [2/2]

template<typename DataT>
VoxelGrid & operator= ( VoxelGrid< DataT > && other)
default

◆ posToCoord() [1/2]

template<typename DataT>
CoordT posToCoord ( const Point3D & pos) const
nodiscard

posToCoord is used to convert real coordinates to CoordT indices.

◆ posToCoord() [2/2]

template<typename DataT>
CoordT posToCoord ( double x,
double y,
double z ) const
nodiscard

posToCoord is used to convert real coordinates to CoordT indices.

◆ releaseUnusedMemory()

template<typename DataT>
void releaseUnusedMemory ( )

Try freeing memory; this will discard grids where all the cells are OFF.

Note that the memory release is NOT guaranteed, since we are using a memory pool too. CAREFULL: This will invalidate all the existing Accessors (you need to create new ones).

◆ rootMap() [1/2]

template<typename DataT>
RootMap & rootMap ( )

◆ rootMap() [2/2]

template<typename DataT>
const RootMap & rootMap ( ) const

◆ voxelSize()

template<typename DataT>
double voxelSize ( ) const

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