Voxomap
A C++11 voxel container.
|
Voxel container used in leaves of the VoxelOctree. Mix between a fixed size 3D array (like in ArrayContainer) and a dynamic array. Useful for little density of voxels. More...
#include <SparseContainer.hpp>
Public Types | |
using | VoxelData = T_Voxel |
using | VoxelContainer = SparseContainer< T_Voxel, T_Container > |
using | iterator = container_iterator< VoxelContainer > |
Public Member Functions | |
SparseContainer ()=default | |
Default constructor. More... | |
SparseContainer (SparseContainer const &other)=default | |
Default copy constructor. More... | |
void | init (VoxelNode< VoxelContainer > const &) |
Initialization method, do nothing. More... | |
uint16_t | getNbVoxel () const |
Returns number of voxels. More... | |
bool | hasVoxel (uint8_t x) const |
Check if there is voxel inside. More... | |
bool | hasVoxel (uint8_t x, uint8_t y) const |
Check if there is voxel inside. More... | |
bool | hasVoxel (uint8_t x, uint8_t y, uint8_t z) const |
Check if voxel exist. More... | |
VoxelData * | findVoxel (uint8_t x, uint8_t y, uint8_t z) |
Find voxel. More... | |
VoxelData const * | findVoxel (uint8_t x, uint8_t y, uint8_t z) const |
Find voxel. More... | |
template<typename Iterator > | |
VoxelData * | findVoxel (Iterator &it) |
Find voxel. More... | |
template<typename Iterator > | |
VoxelData const * | findVoxel (Iterator &it) const |
Find voxel. 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 > | |
bool | removeVoxel (Iterator const &it, VoxelData *voxel=nullptr) |
Remove an existing voxel. 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(SparseContainer const &)> const &predicate) const |
void | serialize (std::string &str) const |
Serialize the structure. More... | |
size_t | unserialize (char const *str, size_t size) |
Unserialize str inside this. More... | |
Static Public Attributes | |
static const uint32_t | NB_VOXELS = 8 |
static const uint32_t | COORD_MASK = ~(NB_VOXELS - 1) |
static const uint32_t | VOXEL_MASK = NB_VOXELS - 1 |
static const uint32_t | NB_SUPERCONTAINER = 0 |
Private Attributes | |
SparseIDArray< T_Voxel, NB_VOXELS, T_Container > | _sparseArray |
Voxel container used in leaves of the VoxelOctree. Mix between a fixed size 3D array (like in ArrayContainer) and a dynamic array. Useful for little density of voxels.
The container uses 3 arrays:
Definition at line 32 of file SparseContainer.hpp.
using voxomap::SparseContainer< T_Voxel, T_Container >::VoxelData = T_Voxel |
Definition at line 35 of file SparseContainer.hpp.
using voxomap::SparseContainer< T_Voxel, T_Container >::VoxelContainer = SparseContainer<T_Voxel, T_Container> |
Definition at line 36 of file SparseContainer.hpp.
using voxomap::SparseContainer< T_Voxel, T_Container >::iterator = container_iterator<VoxelContainer> |
Definition at line 37 of file SparseContainer.hpp.
|
default |
Default constructor.
|
default |
Default copy constructor.
void voxomap::SparseContainer< T_Voxel, T_Container >::init | ( | VoxelNode< VoxelContainer > const & | ) |
Initialization method, do nothing.
Definition at line 56 of file SparseContainer.hpp.
uint16_t voxomap::SparseContainer< T_Voxel, T_Container >::getNbVoxel | ( | ) | const |
Returns number of voxels.
bool voxomap::SparseContainer< T_Voxel, T_Container >::hasVoxel | ( | uint8_t | x | ) | const |
Check if there is voxel inside.
x | X index |
bool voxomap::SparseContainer< T_Voxel, T_Container >::hasVoxel | ( | uint8_t | x, |
uint8_t | y | ||
) | const |
Check if there is voxel inside.
x | X index |
y | Y index |
bool voxomap::SparseContainer< T_Voxel, T_Container >::hasVoxel | ( | uint8_t | x, |
uint8_t | y, | ||
uint8_t | z | ||
) | const |
Check if voxel exist.
x | X index |
y | Y index |
z | Z index |
VoxelData* voxomap::SparseContainer< T_Voxel, T_Container >::findVoxel | ( | uint8_t | x, |
uint8_t | y, | ||
uint8_t | z | ||
) |
Find voxel.
x | X index |
y | Y index |
z | Z index |
VoxelData const* voxomap::SparseContainer< T_Voxel, T_Container >::findVoxel | ( | uint8_t | x, |
uint8_t | y, | ||
uint8_t | z | ||
) | const |
Find voxel.
x | X index |
y | Y index |
z | Z index |
VoxelData* voxomap::SparseContainer< T_Voxel, T_Container >::findVoxel | ( | Iterator & | it | ) |
Find voxel.
it | The iterator |
VoxelData const* voxomap::SparseContainer< T_Voxel, T_Container >::findVoxel | ( | Iterator & | it | ) | const |
Find voxel.
it | The iterator |
bool voxomap::SparseContainer< T_Voxel, T_Container >::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::SparseContainer< T_Voxel, T_Container >::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::SparseContainer< T_Voxel, T_Container >::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::SparseContainer< T_Voxel, T_Container >::removeVoxel | ( | Iterator const & | it, |
VoxelData * | voxel = nullptr |
||
) |
Remove an existing voxel.
it | Iterator that contains the informations |
voxel | Pointer on a voxel structure, filled with the data of the removed voxel |
void voxomap::SparseContainer< T_Voxel, T_Container >::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::SparseContainer< T_Voxel, T_Container >::exploreVoxelContainer | ( | std::function< void(SparseContainer< T_Voxel, T_Container > const &)> const & | predicate | ) | const |
void voxomap::SparseContainer< T_Voxel, T_Container >::serialize | ( | std::string & | str | ) | const |
Serialize the structure.
str | String use for save the serialization |
size_t voxomap::SparseContainer< T_Voxel, T_Container >::unserialize | ( | char const * | str, |
size_t | size | ||
) |
Unserialize str inside this.
str | String that contains data |
size | Size of the string |
|
static |
Definition at line 39 of file SparseContainer.hpp.
|
static |
Definition at line 40 of file SparseContainer.hpp.
|
static |
Definition at line 41 of file SparseContainer.hpp.
|
static |
Definition at line 42 of file SparseContainer.hpp.
|
private |
Definition at line 171 of file SparseContainer.hpp.