Voxomap
A C++11 voxel container.
|
Octree optimized for voxel. More...
#include <VoxelOctree.hpp>
Public Types | |
using | VoxelData = typename T_Container::VoxelData |
using | iterator = typename T_Container::iterator |
Public Member Functions | |
VoxelOctree () | |
Default constructor. More... | |
VoxelOctree (VoxelOctree< T_Container > const &other) | |
Copy constructor. More... | |
VoxelOctree (VoxelOctree< T_Container > &&other) | |
Move constructor. More... | |
virtual | ~VoxelOctree ()=default |
Default destructor. More... | |
VoxelOctree & | operator= (VoxelOctree< T_Container > const &other) |
Assignement operator. More... | |
VoxelOctree & | operator= (VoxelOctree< T_Container > &&other) |
Move assignement operator. More... | |
VoxelNode< T_Container > * | push (VoxelNode< T_Container > &node) override |
Pushes node into the octree. More... | |
std::unique_ptr< VoxelNode< T_Container > > | pop (VoxelNode< T_Container > &node) override |
Removes node from the octree. More... | |
void | clear () override |
Clear the octree Removes all nodes and all elements. More... | |
template<typename T > | |
iterator | findVoxel (T x, T y, T z) |
Returns a voxel iterator. More... | |
template<typename T > | |
VoxelNode< T_Container > * | findVoxelNode (T x, T y, T z) const |
Returns a node, can be NULL. More... | |
template<typename T , typename... Args> | |
std::pair< iterator, bool > | addVoxel (T x, T y, T z, Args &&... args) |
Add the voxel if not exist. More... | |
template<typename T , typename... Args> | |
iterator | updateVoxel (T x, T y, T z, Args &&... args) |
Update the voxel if already exist. More... | |
template<typename... Args> | |
iterator | updateVoxel (iterator it, Args &&... args) |
Update the voxel if already exist. More... | |
template<typename T , typename... Args> | |
iterator | putVoxel (T x, T y, T z, Args &&... args) |
Add or update the voxel. More... | |
template<typename T , typename... Args> | |
bool | removeVoxel (T x, T y, T z, Args &&... args) |
Removes a voxel. More... | |
template<typename... Args> | |
bool | removeVoxel (iterator it, Args &&... args) |
Removes a voxel. More... | |
unsigned int | getContainerSize () const |
Returns the size of containers. More... | |
void | removeOfCache (VoxelNode< T_Container > const &node) |
Calcul the bounding box. More... | |
void | exploreVoxel (std::function< void(iterator const &)> const &predicate) const |
Browse all voxels. More... | |
void | exploreVoxelContainer (std::function< void(typename T_Container::VoxelContainer const &)> const &predicate) const |
Browse all voxel containers. More... | |
void | exploreVoxelNode (std::function< void(VoxelNode< T_Container > const &)> const &predicate) const |
Browse all voxel nodes. More... | |
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. More... | |
unsigned int | getNbVoxels () const |
Get the number of voxels. More... | |
void | setNbVoxels (unsigned int nbVoxels) |
Set the number of voxels. More... | |
iterator | begin () |
Returns an iterator to the first voxel of the octree. More... | |
iterator | end () |
Returns an iterator to the element folowing the last voxel of the octree. More... | |
void | serialize (std::string &str) const |
Serialize the structure. More... | |
size_t | unserialize (char const *str, size_t strsize) |
Unserialize str. More... | |
Protected Member Functions | |
VoxelNode< T_Container > * | pushContainerNode (int x, int y, int z) |
Adds the leaf node that contain the voxel container. More... | |
template<typename T > | |
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. More... | |
Protected Attributes | |
VoxelNode< T_Container > * | _nodeCache = nullptr |
Cache for improve performance. More... | |
unsigned int | _nbVoxels = 0 |
Number of voxels. More... | |
Private Member Functions | |
iterator | _findVoxel (int x, int y, int z) |
Method to find voxel (for integer arguments) More... | |
template<typename T > | |
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) More... | |
VoxelNode< T_Container > * | _findVoxelNode (int x, int y, int z) const |
Method to find node that contain voxel (for integer arguments) More... | |
template<typename T > | |
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) More... | |
Octree optimized for voxel.
Definition at line 19 of file VoxelOctree.hpp.
using voxomap::VoxelOctree< T_Container >::VoxelData = typename T_Container::VoxelData |
Definition at line 27 of file VoxelOctree.hpp.
using voxomap::VoxelOctree< T_Container >::iterator = typename T_Container::iterator |
Definition at line 28 of file VoxelOctree.hpp.
voxomap::VoxelOctree< T_Container >::VoxelOctree | ( | ) |
Default constructor.
voxomap::VoxelOctree< T_Container >::VoxelOctree | ( | VoxelOctree< T_Container > const & | other | ) |
Copy constructor.
voxomap::VoxelOctree< T_Container >::VoxelOctree | ( | VoxelOctree< T_Container > && | other | ) |
Move constructor.
|
virtualdefault |
Default destructor.
VoxelOctree& voxomap::VoxelOctree< T_Container >::operator= | ( | VoxelOctree< T_Container > const & | other | ) |
Assignement operator.
VoxelOctree& voxomap::VoxelOctree< T_Container >::operator= | ( | VoxelOctree< T_Container > && | other | ) |
Move assignement operator.
|
override |
Pushes node into the octree.
node | Node to push |
|
override |
|
override |
Clear the octree Removes all nodes and all elements.
iterator voxomap::VoxelOctree< T_Container >::findVoxel | ( | T | x, |
T | y, | ||
T | z | ||
) |
Returns a voxel iterator.
x | X coordinate |
y | Y coordinate |
z | Z coordinate |
VoxelNode<T_Container>* voxomap::VoxelOctree< T_Container >::findVoxelNode | ( | T | x, |
T | y, | ||
T | z | ||
) | const |
Returns a node, can be NULL.
x | X coordinate |
y | Y coordinate |
z | Z coordinate |
std::pair<iterator, bool> voxomap::VoxelOctree< T_Container >::addVoxel | ( | T | x, |
T | y, | ||
T | z, | ||
Args &&... | args | ||
) |
Add the voxel if not exist.
x | X coordinate |
y | Y coordinate |
z | Z coordinate |
args | Arguments forward to VoxelData constructor |
iterator voxomap::VoxelOctree< T_Container >::updateVoxel | ( | T | x, |
T | y, | ||
T | z, | ||
Args &&... | args | ||
) |
Update the voxel if already exist.
x | X coordinate |
y | Y coordinate |
z | Z coordinate |
args | Arguments forward to VoxelData constructor |
iterator voxomap::VoxelOctree< T_Container >::updateVoxel | ( | iterator | it, |
Args &&... | args | ||
) |
Update the voxel if already exist.
it | Iterator of the voxel to remove |
args | Arguments forward to VoxelData constructor |
iterator voxomap::VoxelOctree< T_Container >::putVoxel | ( | T | x, |
T | y, | ||
T | z, | ||
Args &&... | args | ||
) |
Add or update the voxel.
x | X coordinate |
y | Y coordinate |
z | Z coordinate |
args | Arguments forward to VoxelData constructor |
bool voxomap::VoxelOctree< T_Container >::removeVoxel | ( | T | x, |
T | y, | ||
T | z, | ||
Args &&... | args | ||
) |
Removes a voxel.
x | X coordinate |
y | Y coordinate |
z | Z coordinate |
args | Arguments forward to removeVoxel area method |
bool voxomap::VoxelOctree< T_Container >::removeVoxel | ( | iterator | it, |
Args &&... | args | ||
) |
Removes a voxel.
it | Iterator of the voxel to remove |
args | Arguments forward to removeVoxel area method |
unsigned int voxomap::VoxelOctree< T_Container >::getContainerSize | ( | ) | const |
Returns the size of containers.
void voxomap::VoxelOctree< T_Container >::removeOfCache | ( | VoxelNode< T_Container > const & | node | ) |
Calcul the bounding box.
void voxomap::VoxelOctree< T_Container >::exploreVoxel | ( | std::function< void(iterator const &)> const & | predicate | ) | const |
Browse all voxels.
predicate | Function called for each voxel |
void voxomap::VoxelOctree< T_Container >::exploreVoxelContainer | ( | std::function< void(typename T_Container::VoxelContainer const &)> const & | predicate | ) | const |
Browse all voxel containers.
predicate | Function called for each voxel container |
void voxomap::VoxelOctree< T_Container >::exploreVoxelNode | ( | std::function< void(VoxelNode< T_Container > const &)> const & | predicate | ) | const |
Browse all voxel nodes.
predicate | Function called for each voxel node |
void voxomap::VoxelOctree< T_Container >::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.
bounding_box | The aligned axis bounding box |
in_predicate | Function called for each voxel container inside the bounding box |
out_predicate | Function called for each voxel container outside the bounding box |
unsigned int voxomap::VoxelOctree< T_Container >::getNbVoxels | ( | ) | const |
Get the number of voxels.
void voxomap::VoxelOctree< T_Container >::setNbVoxels | ( | unsigned int | nbVoxels | ) |
Set the number of voxels.
nbVoxels | Number of voxels |
iterator voxomap::VoxelOctree< T_Container >::begin | ( | ) |
Returns an iterator to the first voxel of the octree.
iterator voxomap::VoxelOctree< T_Container >::end | ( | ) |
Returns an iterator to the element folowing the last voxel of the octree.
void voxomap::VoxelOctree< T_Container >::serialize | ( | std::string & | str | ) | const |
Serialize the structure.
str | String use for save the serialization |
size_t voxomap::VoxelOctree< T_Container >::unserialize | ( | char const * | str, |
size_t | strsize | ||
) |
Unserialize str.
str | String that contains data |
strsize | Size of the string |
|
private |
Method to find voxel (for integer arguments)
x | X coordinate of the voxel |
y | Y coordinate of the voxel |
z | Z coordinate of the voxel |
|
private |
Method to find voxel (for floating point arguments)
x | X coordinate of the voxel |
y | Y coordinate of the voxel |
z | Z coordinate of the voxel |
|
private |
Method to find node that contain voxel (for integer arguments)
x | X coordinate of the voxel |
y | Y coordinate of the voxel |
z | Z coordinate of the voxel |
|
private |
Method to find node that contain voxel (for floating point arguments)
x | X coordinate of the voxel |
y | Y coordinate of the voxel |
z | Z coordinate of the voxel |
|
protected |
Adds the leaf node that contain the voxel container.
x | X coordinate of the voxel |
y | Y coordinate of the voxel |
z | Z coordinate of the voxel |
|
protected |
Adds the leaf node that contain the voxel container.
x | X coordinate of the voxel |
y | Y coordinate of the voxel |
z | Z coordinate of the voxel |
|
mutableprotected |
Cache for improve performance.
Definition at line 273 of file VoxelOctree.hpp.
|
protected |
Number of voxels.
Definition at line 274 of file VoxelOctree.hpp.