 |
Voxomap
A C++11 voxel container.
|
Go to the documentation of this file. 1 #ifndef _VOXOMAP_ARRAYCONTAINER_HPP_
2 #define _VOXOMAP_ARRAYCONTAINER_HPP_
5 #include "../iterator.hpp"
16 template <
class T_Container>
class VoxelNode;
27 template <
class T_Voxel>
30 static_assert(std::is_trivially_copyable<T_Voxel>::value,
"ArrayContainer only accept trivially copyable object");
82 bool hasVoxel(uint8_t x, uint8_t y, uint8_t z)
const;
104 template <
typename Iterator>
111 template <
typename Iterator>
120 template <
typename Iterator,
typename... Args>
128 template <
typename Iterator,
typename... Args>
135 template <
typename Iterator,
typename... Args>
143 template <
typename Iterator>
151 template <
typename Iterator>
152 void exploreVoxel(Iterator& it, std::function<
void(Iterator
const&)>
const& predicate)
const;
181 template <
typename T>
182 typename std::enable_if<std::is_trivially_constructible<T>::value>::type
copy(T
const& other);
186 template <
typename T>
187 typename std::enable_if<!std::is_trivially_constructible<T>::value>::type
copy(T
const& other);
197 #include "ArrayContainer.ipp"
199 #endif // _VOXOMAP_ARRAYCONTAINER_HPP_
static const uint32_t NB_VOXELS
static const VoxelData _emptyArea[NB_VOXELS][NB_VOXELS][NB_VOXELS]
ArrayContainer()
Default constructor.
void putVoxel(Iterator &it, Args &&... args)
Add or update a voxel.
uint16_t getNbVoxel() const
Returns number of voxels.
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.
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.
VoxelData * findVoxel(Iterator &it)
Find voxel.
Voxel container used in leaves of the VoxelOctree. Based on a fixed size 3D array,...
VoxelData const * findVoxel(Iterator &it) const
Find voxel.
static const uint32_t NB_SUPERCONTAINER
void init(VoxelNode< ArrayContainer< VoxelData >> const &)
Initialization method, do nothing.
void serialize(std::string &str) const
Serialize the structure.
bool hasVoxel(uint8_t x, uint8_t y) const
Check if there is voxel inside.
ArrayContainer(ArrayContainer &&other)=default
Default move constructor.
Node optimized for voxel.
ArrayContainer(ArrayContainer const &other)
Copy constructor.
static const uint32_t VOXEL_MASK
VoxelData const * findVoxel(uint8_t x, uint8_t y, uint8_t z) const
Find voxel.
uint16_t nbVoxels
Number of voxels.
std::enable_if< std::is_trivially_constructible< T >::value >::type copy(T const &other)
Method use to copy data when voxel is trivially constructible.
char _
Compiler hack to avoid the call of the default constructor of each VoxelData of area.
VoxelData * findVoxel(uint8_t x, uint8_t y, uint8_t z)
Find voxel.
void exploreVoxelContainer(std::function< void(ArrayContainer const &)> const &predicate) const
bool removeVoxel(Iterator const &it, VoxelData *voxel=nullptr)
Remove an existing voxel.
bool updateVoxel(Iterator &it, Args &&... args)
Update an existing voxel, don't create a new one.
bool hasVoxel(uint8_t x, uint8_t y, uint8_t z) const
Check if voxel exist.
bool hasVoxel(uint8_t x) const
Check if there is voxel inside.
size_t unserialize(char const *str, size_t size)
Unserialize str inside this.
bool addVoxel(Iterator &it, Args &&... args)
Add a voxel, don't update an existing voxel.
static const uint32_t COORD_MASK
VoxelData area[NB_VOXELS][NB_VOXELS][NB_VOXELS]
Array of voxels.