Voxomap
A C++11 voxel container.
|
Super container used in leaves of the VoxelOctree. Mix between a fixed size 3D array (like in ArraySuperContainer) and a dynamic array. Useful for little density of sub-containers. More...
#include <SparseSuperContainer.hpp>
Public Types | |
using | Container = T_Container |
using | VoxelData = typename Container::VoxelData |
using | VoxelContainer = typename Container::VoxelContainer |
using | iterator = supercontainer_iterator< SparseSuperContainer< Container, T_InternalContainer > > |
Public Member Functions | |
SparseSuperContainer ()=default | |
Default constructor. More... | |
SparseSuperContainer (SparseSuperContainer const &other)=default | |
Default Copy constructor. More... | |
SparseSuperContainer (SparseSuperContainer &&other)=default | |
Default move constructor. More... | |
~SparseSuperContainer ()=default | |
Default destructor. More... | |
void | init (VoxelNode< SparseSuperContainer< Container, T_InternalContainer >> const &) |
Initialization method, do nothing. More... | |
uint32_t | getNbVoxel () const |
Returns number of voxels. More... | |
template<typename Iterator > | |
VoxelData * | findVoxel (Iterator &it) |
Find voxel. More... | |
template<typename Iterator > | |
VoxelData const * | findVoxel (Iterator &it) const |
Find voxel. More... | |
bool | hasContainer (uint8_t x) const |
Check if there is sub-container. More... | |
bool | hasContainer (uint8_t x, uint8_t y) const |
Check if there is sub-container. More... | |
bool | hasContainer (uint8_t x, uint8_t y, uint8_t z) const |
Check if there is sub-container. More... | |
Container * | findContainer (uint8_t x, uint8_t y, uint8_t z) |
Find sub-container. More... | |
Container const * | findContainer (uint8_t x, uint8_t y, uint8_t z) const |
Find sub-container. More... | |
template<typename Iterator , typename... Args> | |
bool | addVoxel (Iterator &it, Args &&... args) |
Add a voxel, don't update an existing voxel. More... | |
template<typename Iterator , typename... Args> | |
bool | updateVoxel (Iterator &it, Args &&... args) |
Update an existing voxel, don't create a new one. More... | |
template<typename Iterator , typename... Args> | |
void | putVoxel (Iterator &it, Args &&... args) |
Add or update a voxel. More... | |
template<typename Iterator , typename... Args> | |
bool | removeVoxel (Iterator const &it, Args &&... args) |
Remove an existing voxel. More... | |
void | serialize (std::string &str) const |
Serialize the structure. More... | |
size_t | unserialize (char const *str, size_t size) |
Unserialize str inside this. More... | |
template<typename Iterator > | |
void | exploreVoxel (Iterator &it, std::function< void(Iterator const &)> const &predicate) const |
Go through all voxels of the container and call the predicate for each. More... | |
void | exploreVoxelContainer (std::function< void(typename T_Container::VoxelContainer const &)> const &predicate) const |
Static Public Attributes | |
static const uint32_t | NB_CONTAINERS = 8 |
static const uint32_t | CONTAINER_MASK = NB_CONTAINERS - 1 |
static const uint32_t | NB_VOXELS = NB_CONTAINERS * Container::NB_VOXELS |
static const uint32_t | COORD_MASK = ~(NB_VOXELS - 1) |
static const uint32_t | VOXEL_MASK = Container::VOXEL_MASK |
static const uint32_t | NB_SUPERCONTAINER = 1 + Container::NB_SUPERCONTAINER |
static const uint32_t | SUPERCONTAINER_ID = NB_SUPERCONTAINER - 1 |
Private Attributes | |
SparseIDArray< std::unique_ptr< Container >, NB_CONTAINERS, T_InternalContainer > | _sparseArray |
uint32_t | _nbVoxels = 0 |
Number of voxels. More... | |
Super container used in leaves of the VoxelOctree. Mix between a fixed size 3D array (like in ArraySuperContainer) and a dynamic array. Useful for little density of sub-containers.
The container uses 3 arrays:
Definition at line 41 of file SparseSuperContainer.hpp.
using voxomap::SparseSuperContainer< T_Container, T_InternalContainer >::Container = T_Container |
Definition at line 43 of file SparseSuperContainer.hpp.
using voxomap::SparseSuperContainer< T_Container, T_InternalContainer >::VoxelData = typename Container::VoxelData |
Definition at line 44 of file SparseSuperContainer.hpp.
using voxomap::SparseSuperContainer< T_Container, T_InternalContainer >::VoxelContainer = typename Container::VoxelContainer |
Definition at line 45 of file SparseSuperContainer.hpp.
using voxomap::SparseSuperContainer< T_Container, T_InternalContainer >::iterator = supercontainer_iterator<SparseSuperContainer<Container, T_InternalContainer> > |
Definition at line 46 of file SparseSuperContainer.hpp.
|
default |
Default constructor.
|
default |
Default Copy constructor.
|
default |
Default move constructor.
|
default |
Default destructor.
void voxomap::SparseSuperContainer< T_Container, T_InternalContainer >::init | ( | VoxelNode< SparseSuperContainer< Container, T_InternalContainer >> const & | ) |
Initialization method, do nothing.
Definition at line 77 of file SparseSuperContainer.hpp.
uint32_t voxomap::SparseSuperContainer< T_Container, T_InternalContainer >::getNbVoxel | ( | ) | const |
Returns number of voxels.
VoxelData* voxomap::SparseSuperContainer< T_Container, T_InternalContainer >::findVoxel | ( | Iterator & | it | ) |
Find voxel.
it | Iterator containing voxel position information |
VoxelData const* voxomap::SparseSuperContainer< T_Container, T_InternalContainer >::findVoxel | ( | Iterator & | it | ) | const |
Find voxel.
it | Iterator containing voxel position information |
bool voxomap::SparseSuperContainer< T_Container, T_InternalContainer >::hasContainer | ( | uint8_t | x | ) | const |
Check if there is sub-container.
x | X index |
bool voxomap::SparseSuperContainer< T_Container, T_InternalContainer >::hasContainer | ( | uint8_t | x, |
uint8_t | y | ||
) | const |
Check if there is sub-container.
x | X index |
y | Y index |
bool voxomap::SparseSuperContainer< T_Container, T_InternalContainer >::hasContainer | ( | uint8_t | x, |
uint8_t | y, | ||
uint8_t | z | ||
) | const |
Check if there is sub-container.
x | X index |
y | Y index |
z | Z index |
Container* voxomap::SparseSuperContainer< T_Container, T_InternalContainer >::findContainer | ( | uint8_t | x, |
uint8_t | y, | ||
uint8_t | z | ||
) |
Find sub-container.
x | X index |
y | Y index |
z | Z index |
Container const* voxomap::SparseSuperContainer< T_Container, T_InternalContainer >::findContainer | ( | uint8_t | x, |
uint8_t | y, | ||
uint8_t | z | ||
) | const |
Find sub-container.
x | X index |
y | Y index |
z | Z index |
bool voxomap::SparseSuperContainer< T_Container, T_InternalContainer >::addVoxel | ( | Iterator & | it, |
Args &&... | args | ||
) |
Add a voxel, don't update an existing voxel.
it | Iterator that contains the informations |
args | Arguments to forward to voxel constructor |
bool voxomap::SparseSuperContainer< T_Container, T_InternalContainer >::updateVoxel | ( | Iterator & | it, |
Args &&... | args | ||
) |
Update an existing voxel, don't create a new one.
it | Iterator that contains the informations |
args | Arguments to forward to voxel constructor |
void voxomap::SparseSuperContainer< T_Container, T_InternalContainer >::putVoxel | ( | Iterator & | it, |
Args &&... | args | ||
) |
Add or update a voxel.
it | Iterator that contains the informations |
args | Arguments to forward to voxel constructor |
bool voxomap::SparseSuperContainer< T_Container, T_InternalContainer >::removeVoxel | ( | Iterator const & | it, |
Args &&... | args | ||
) |
Remove an existing voxel.
it | Iterator that contains the informations |
args | Arguments to forward to removeVoxel method of the container |
void voxomap::SparseSuperContainer< T_Container, T_InternalContainer >::serialize | ( | std::string & | str | ) | const |
Serialize the structure.
str | String use for save the serialization |
size_t voxomap::SparseSuperContainer< T_Container, T_InternalContainer >::unserialize | ( | char const * | str, |
size_t | size | ||
) |
Unserialize str inside this.
str | String that contains data |
size | Size of the string |
void voxomap::SparseSuperContainer< T_Container, T_InternalContainer >::exploreVoxel | ( | Iterator & | it, |
std::function< void(Iterator const &)> const & | predicate | ||
) | const |
Go through all voxels of the container and call the predicate for each.
it | Begin iterator |
predicate | Function called for each voxel found |
void voxomap::SparseSuperContainer< T_Container, T_InternalContainer >::exploreVoxelContainer | ( | std::function< void(typename T_Container::VoxelContainer const &)> const & | predicate | ) | const |
|
static |
Definition at line 48 of file SparseSuperContainer.hpp.
|
static |
Definition at line 49 of file SparseSuperContainer.hpp.
|
static |
Definition at line 50 of file SparseSuperContainer.hpp.
|
static |
Definition at line 51 of file SparseSuperContainer.hpp.
|
static |
Definition at line 52 of file SparseSuperContainer.hpp.
|
static |
Definition at line 53 of file SparseSuperContainer.hpp.
|
static |
Definition at line 54 of file SparseSuperContainer.hpp.
|
private |
Definition at line 191 of file SparseSuperContainer.hpp.
|
private |
Number of voxels.
Definition at line 192 of file SparseSuperContainer.hpp.