 |
Voxomap
A C++11 voxel container.
|
Go to the documentation of this file. 1 #ifndef _VOXOMAP_VOXELOCTREE_HPP_
2 #define _VOXOMAP_VOXELOCTREE_HPP_
5 #include "../octree/Octree.hpp"
7 #include "../utils/BoundingBox.hpp"
17 template <
class T_Container>
class VoxelNode;
23 template <
class T_Container>
24 class VoxelOctree :
public Octree<VoxelNode<T_Container>>
28 using iterator =
typename T_Container::iterator;
99 template <
typename T,
typename... Args>
100 std::pair<iterator, bool>
addVoxel(T x, T y, T z, Args&&... args);
109 template <
typename T,
typename... Args>
117 template <
typename... Args>
127 template <
typename T,
typename... Args>
138 template <
typename T,
typename... Args>
146 template <
typename... Args>
169 void exploreVoxelContainer(std::function<
void(
typename T_Container::VoxelContainer
const&)>
const& predicate)
const;
233 template <
typename T>
251 template <
typename T>
270 template <
typename T>
279 #include "VoxelOctree.ipp"
281 #endif // _VOXOMAP_VOXELOCTREE_HPP_
iterator _findVoxel(int x, int y, int z)
Method to find voxel (for integer arguments)
void removeOfCache(VoxelNode< T_Container > const &node)
Calcul the bounding box.
bool removeVoxel(iterator it, Args &&... args)
Removes a voxel.
iterator findVoxel(T x, T y, T z)
Returns a voxel iterator.
std::enable_if< std::is_floating_point< T >::value, iterator >::type _findVoxel(T x, T y, T z)
Method to find voxel (for floating point arguments)
iterator putVoxel(T x, T y, T z, Args &&... args)
Add or update the voxel.
bool removeVoxel(T x, T y, T z, Args &&... args)
Removes a voxel.
void clear() override
Clear the octree Removes all nodes and all elements.
VoxelOctree & operator=(VoxelOctree< T_Container > &&other)
Move assignement operator.
std::pair< iterator, bool > addVoxel(T x, T y, T z, Args &&... args)
Add the voxel if not exist.
iterator updateVoxel(iterator it, Args &&... args)
Update the voxel if already exist.
typename T_Container::VoxelData VoxelData
virtual ~VoxelOctree()=default
Default destructor.
void exploreBoundingBox(BoundingBox< int > const &bounding_box, std::function< void(VoxelNode< T_Container > &)> const &in_predicate, std::function< void(VoxelNode< T_Container > &)> const &out_predicate)
Browse all voxel containers.
iterator end()
Returns an iterator to the element folowing the last voxel of the octree.
Node optimized for voxel.
unsigned int _nbVoxels
Number of voxels.
unsigned int getContainerSize() const
Returns the size of containers.
std::enable_if< std::is_floating_point< T >::value, VoxelNode< T_Container > * >::type _findVoxelNode(T x, T y, T z) const
Method to find node that contain voxel (for floating point arguments)
VoxelOctree(VoxelOctree< T_Container > const &other)
Copy constructor.
Octree optimized for voxel.
VoxelNode< T_Container > * push(VoxelNode< T_Container > &node) override
Pushes node into the octree.
std::unique_ptr< VoxelNode< T_Container > > pop(VoxelNode< T_Container > &node) override
Removes node from the octree.
VoxelOctree & operator=(VoxelOctree< T_Container > const &other)
Assignement operator.
VoxelOctree(VoxelOctree< T_Container > &&other)
Move constructor.
size_t unserialize(char const *str, size_t strsize)
Unserialize str.
iterator begin()
Returns an iterator to the first voxel of the octree.
VoxelOctree()
Default constructor.
void exploreVoxelContainer(std::function< void(typename T_Container::VoxelContainer const &)> const &predicate) const
Browse all voxel containers.
void exploreVoxel(std::function< void(iterator const &)> const &predicate) const
Browse all voxels.
void exploreVoxelNode(std::function< void(VoxelNode< T_Container > const &)> const &predicate) const
Browse all voxel nodes.
std::enable_if< std::is_floating_point< T >::value, VoxelNode< T_Container > * >::type pushContainerNode(T x, T y, T z)
Adds the leaf node that contain the voxel container.
VoxelNode< T_Container > * _nodeCache
Cache for improve performance.
VoxelNode< T_Container > * findVoxelNode(T x, T y, T z) const
Returns a node, can be NULL.
typename T_Container::iterator iterator
void serialize(std::string &str) const
Serialize the structure.
unsigned int getNbVoxels() const
Get the number of voxels.
iterator updateVoxel(T x, T y, T z, Args &&... args)
Update the voxel if already exist.
VoxelNode< T_Container > * pushContainerNode(int x, int y, int z)
Adds the leaf node that contain the voxel container.
void setNbVoxels(unsigned int nbVoxels)
Set the number of voxels.
VoxelNode< T_Container > * _findVoxelNode(int x, int y, int z) const
Method to find node that contain voxel (for integer arguments)