|
Voxomap
A C++11 voxel container.
|
Voxel container used in leaves of the VoxelOctree. Based on a fixed size 3D array, useful for high density of voxels. More...
#include <ArrayContainer.hpp>
Public Types | |
| using | VoxelData = T_Voxel |
| using | VoxelContainer = ArrayContainer< T_Voxel > |
| using | iterator = container_iterator< ArrayContainer< T_Voxel > > |
Public Member Functions | |
| ArrayContainer () | |
| Default constructor. More... | |
| ArrayContainer (ArrayContainer const &other) | |
| Copy constructor. More... | |
| ArrayContainer (ArrayContainer &&other)=default | |
| Default move constructor. More... | |
| void | init (VoxelNode< ArrayContainer< VoxelData >> 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(ArrayContainer 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... | |
Public Attributes | |
| uint16_t | nbVoxels = 0 |
| Number of voxels. More... | |
| union { | |
| VoxelData area [NB_VOXELS][NB_VOXELS][NB_VOXELS] | |
| Array of voxels. More... | |
| char _ | |
| Compiler hack to avoid the call of the default constructor of each VoxelData of area. 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 Member Functions | |
| template<typename T > | |
| std::enable_if< std::is_trivially_constructible< T >::value >::type | copy (T const &other) |
| Method use to copy data when voxel is trivially constructible. More... | |
| template<typename T > | |
| std::enable_if<!std::is_trivially_constructible< T >::value >::type | copy (T const &other) |
| Method use to copy data when voxel is not trivially constructible. More... | |
Static Private Attributes | |
| static const VoxelData | _emptyArea [NB_VOXELS][NB_VOXELS][NB_VOXELS] |
Voxel container used in leaves of the VoxelOctree. Based on a fixed size 3D array, useful for high density of voxels.
Definition at line 28 of file ArrayContainer.hpp.
| using voxomap::ArrayContainer< T_Voxel >::VoxelData = T_Voxel |
Definition at line 32 of file ArrayContainer.hpp.
| using voxomap::ArrayContainer< T_Voxel >::VoxelContainer = ArrayContainer<T_Voxel> |
Definition at line 33 of file ArrayContainer.hpp.
| using voxomap::ArrayContainer< T_Voxel >::iterator = container_iterator<ArrayContainer<T_Voxel> > |
Definition at line 34 of file ArrayContainer.hpp.
| voxomap::ArrayContainer< T_Voxel >::ArrayContainer | ( | ) |
Default constructor.
| voxomap::ArrayContainer< T_Voxel >::ArrayContainer | ( | ArrayContainer< T_Voxel > const & | other | ) |
Copy constructor.
|
default |
Default move constructor.
| void voxomap::ArrayContainer< T_Voxel >::init | ( | VoxelNode< ArrayContainer< VoxelData >> const & | ) |
Initialization method, do nothing.
Definition at line 57 of file ArrayContainer.hpp.
| uint16_t voxomap::ArrayContainer< T_Voxel >::getNbVoxel | ( | ) | const |
Returns number of voxels.
| bool voxomap::ArrayContainer< T_Voxel >::hasVoxel | ( | uint8_t | x | ) | const |
Check if there is voxel inside.
| x | X index |
| bool voxomap::ArrayContainer< T_Voxel >::hasVoxel | ( | uint8_t | x, |
| uint8_t | y | ||
| ) | const |
Check if there is voxel inside.
| x | X index |
| y | Y index |
| bool voxomap::ArrayContainer< T_Voxel >::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::ArrayContainer< T_Voxel >::findVoxel | ( | uint8_t | x, |
| uint8_t | y, | ||
| uint8_t | z | ||
| ) |
Find voxel.
| x | X index |
| y | Y index |
| z | Z index |
| VoxelData const* voxomap::ArrayContainer< T_Voxel >::findVoxel | ( | uint8_t | x, |
| uint8_t | y, | ||
| uint8_t | z | ||
| ) | const |
Find voxel.
| x | X index |
| y | Y index |
| z | Z index |
| VoxelData* voxomap::ArrayContainer< T_Voxel >::findVoxel | ( | Iterator & | it | ) |
Find voxel.
| it | The iterator |
| VoxelData const* voxomap::ArrayContainer< T_Voxel >::findVoxel | ( | Iterator & | it | ) | const |
Find voxel.
| it | The iterator |
| bool voxomap::ArrayContainer< T_Voxel >::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::ArrayContainer< T_Voxel >::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::ArrayContainer< T_Voxel >::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::ArrayContainer< T_Voxel >::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::ArrayContainer< T_Voxel >::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::ArrayContainer< T_Voxel >::exploreVoxelContainer | ( | std::function< void(ArrayContainer< T_Voxel > const &)> const & | predicate | ) | const |
| void voxomap::ArrayContainer< T_Voxel >::serialize | ( | std::string & | str | ) | const |
Serialize the structure.
| str | String use for save the serialization |
| size_t voxomap::ArrayContainer< T_Voxel >::unserialize | ( | char const * | str, |
| size_t | size | ||
| ) |
Unserialize str inside this.
| str | String that contains data |
| size | Size of the string |
|
private |
Method use to copy data when voxel is trivially constructible.
|
private |
Method use to copy data when voxel is not trivially constructible.
|
static |
Definition at line 36 of file ArrayContainer.hpp.
|
static |
Definition at line 37 of file ArrayContainer.hpp.
|
static |
Definition at line 38 of file ArrayContainer.hpp.
|
static |
Definition at line 39 of file ArrayContainer.hpp.
| uint16_t voxomap::ArrayContainer< T_Voxel >::nbVoxels = 0 |
Number of voxels.
Definition at line 171 of file ArrayContainer.hpp.
| VoxelData voxomap::ArrayContainer< T_Voxel >::area[NB_VOXELS][NB_VOXELS][NB_VOXELS] |
Array of voxels.
Definition at line 173 of file ArrayContainer.hpp.
| char voxomap::ArrayContainer< T_Voxel >::_ |
Compiler hack to avoid the call of the default constructor of each VoxelData of area.
Definition at line 174 of file ArrayContainer.hpp.
| union { ... } |
|
staticprivate |
Used for initialize ArrayContainer::area attribute without call constructor on each VoxelData of array
Definition at line 192 of file ArrayContainer.hpp.