Voxomap
A C++11 voxel container.
voxomap::Octree< T_Node > Class Template Reference

Octree container. More...

#include <Octree.hpp>

Public Types

using Node = T_Node
 

Public Member Functions

 Octree ()
 Default constructor. More...
 
 Octree (Octree const &other)
 Copy constructor. More...
 
 Octree (Octree &&other)
 Move constructor. More...
 
virtual ~Octree ()=default
 Default virtual destructor. More...
 
Octreeoperator= (Octree const &other)
 Assignement operator. More...
 
Octreeoperator= (Octree &&other)
 Assignement move operator. More...
 
virtual T_Node * push (T_Node &node)
 Pushes node into the octree. More...
 
virtual std::unique_ptr< T_Node > pop (T_Node &node)
 Removes node from the octree. More...
 
T_Node * findNode (int x, int y, int z, int size) const
 Search the node that corresponds to the parameters. More...
 
virtual void clear ()
 Clear the octree Removes all nodes and all elements. More...
 
T_Node * getRootNode () const
 Getter of the root node. More...
 

Protected Member Functions

uint8_t findNodeNb (T_Node const &node) const
 Method use to find the index of node inside the root node. More...
 
void setChild (T_Node &parent, T_Node &child)
 Set child as child of parent. More...
 
void setChild (T_Node &parent, T_Node &child, uint8_t childId)
 Set child as child of parent. More...
 
void removeParent (T_Node &child)
 Remove the parent node of child from the octree. More...
 
T_Node * removeChild (T_Node &parent, uint8_t id)
 Remove the child with id from the parent node. More...
 
T_Node * findParentNode (T_Node &parent, T_Node &node, uint8_t &childId) const
 Find node inside parent that can contain node. More...
 
T_Node * push (T_Node &parent, T_Node &node)
 Push node inside parent. More...
 
T_Node * push (T_Node &parent, T_Node &child, uint8_t childId)
 Push node inside parent. More...
 
void insertNode (T_Node &child, T_Node &newChild)
 Create parent node that can contain child and newChild and push it into octree. More...
 
void merge (T_Node &currentNode, T_Node &newNode)
 Merge two nodes. More...
 

Protected Attributes

std::unique_ptr< T_Node > _rootNode
 Main node of the octree. More...
 

Detailed Description

template<class T_Node>
class voxomap::Octree< T_Node >

Octree container.

Definition at line 22 of file Octree.hpp.

Member Typedef Documentation

◆ Node

template<class T_Node >
using voxomap::Octree< T_Node >::Node = T_Node

Definition at line 25 of file Octree.hpp.

Constructor & Destructor Documentation

◆ Octree() [1/3]

template<class T_Node >
voxomap::Octree< T_Node >::Octree ( )

Default constructor.

◆ Octree() [2/3]

template<class T_Node >
voxomap::Octree< T_Node >::Octree ( Octree< T_Node > const &  other)

Copy constructor.

◆ Octree() [3/3]

template<class T_Node >
voxomap::Octree< T_Node >::Octree ( Octree< T_Node > &&  other)

Move constructor.

◆ ~Octree()

template<class T_Node >
virtual voxomap::Octree< T_Node >::~Octree ( )
virtualdefault

Default virtual destructor.

Member Function Documentation

◆ operator=() [1/2]

template<class T_Node >
Octree& voxomap::Octree< T_Node >::operator= ( Octree< T_Node > const &  other)

Assignement operator.

Parameters
otherRight operand
Returns
Reference to this

◆ operator=() [2/2]

template<class T_Node >
Octree& voxomap::Octree< T_Node >::operator= ( Octree< T_Node > &&  other)

Assignement move operator.

Parameters
otherRight operand
Returns
Reference to this

◆ push() [1/3]

template<class T_Node >
virtual T_Node* voxomap::Octree< T_Node >::push ( T_Node &  node)
virtual

Pushes node into the octree.

Parameters
nodeNode to push

◆ pop()

template<class T_Node >
virtual std::unique_ptr<T_Node> voxomap::Octree< T_Node >::pop ( T_Node &  node)
virtual

Removes node from the octree.

Returns

◆ findNode()

template<class T_Node >
T_Node* voxomap::Octree< T_Node >::findNode ( int  x,
int  y,
int  z,
int  size 
) const

Search the node that corresponds to the parameters.

Parameters
xX coordinate of the node
yY coordinate of the node
zZ coordinate of the node
sizeSize of the node
Returns
Pointer to the node if it exists otherwise nullptr

◆ clear()

template<class T_Node >
virtual void voxomap::Octree< T_Node >::clear ( )
virtual

Clear the octree Removes all nodes and all elements.

◆ getRootNode()

template<class T_Node >
T_Node* voxomap::Octree< T_Node >::getRootNode ( ) const

Getter of the root node.

Returns
The root node

◆ findNodeNb()

template<class T_Node >
uint8_t voxomap::Octree< T_Node >::findNodeNb ( T_Node const &  node) const
protected

Method use to find the index of node inside the root node.

Parameters
nodeThe node
Returns
The index

◆ setChild() [1/2]

template<class T_Node >
void voxomap::Octree< T_Node >::setChild ( T_Node &  parent,
T_Node &  child 
)
protected

Set child as child of parent.

Parameters
parentParent node
childChild node

◆ setChild() [2/2]

template<class T_Node >
void voxomap::Octree< T_Node >::setChild ( T_Node &  parent,
T_Node &  child,
uint8_t  childId 
)
protected

Set child as child of parent.

Parameters
parentParent node
childChild node
childIdId of the child inside parent's children array

◆ removeParent()

template<class T_Node >
void voxomap::Octree< T_Node >::removeParent ( T_Node &  child)
protected

Remove the parent node of child from the octree.

◆ removeChild()

template<class T_Node >
T_Node* voxomap::Octree< T_Node >::removeChild ( T_Node &  parent,
uint8_t  id 
)
protected

Remove the child with id from the parent node.

Returns
The removed node

◆ findParentNode()

template<class T_Node >
T_Node* voxomap::Octree< T_Node >::findParentNode ( T_Node &  parent,
T_Node &  node,
uint8_t &  childId 
) const
protected

Find node inside parent that can contain node.

Parameters
parentParent node
nodeThe new node
childIdId of the node inside the found parent
Returns
The found parent node, nullptr if not exist

◆ push() [2/3]

template<class T_Node >
T_Node* voxomap::Octree< T_Node >::push ( T_Node &  parent,
T_Node &  node 
)
protected

Push node inside parent.

Parameters
parentParent node
nodeNode to push
Returns
Node added, can be different than node if a similar node already exist

◆ push() [3/3]

template<class T_Node >
T_Node* voxomap::Octree< T_Node >::push ( T_Node &  parent,
T_Node &  child,
uint8_t  childId 
)
protected

Push node inside parent.

Parameters
parentParent node
childChild node
childIdId of the child inside parent's children array
Returns
Node added, can be different than node if a similar node already exist

◆ insertNode()

template<class T_Node >
void voxomap::Octree< T_Node >::insertNode ( T_Node &  child,
T_Node &  newChild 
)
protected

Create parent node that can contain child and newChild and push it into octree.

◆ merge()

template<class T_Node >
void voxomap::Octree< T_Node >::merge ( T_Node &  currentNode,
T_Node &  newNode 
)
protected

Merge two nodes.

Parameters
currentNodeNode already present in the octree
newNodeNode to merge inside

Member Data Documentation

◆ _rootNode

template<class T_Node >
std::unique_ptr<T_Node> voxomap::Octree< T_Node >::_rootNode
protected

Main node of the octree.

Definition at line 153 of file Octree.hpp.


The documentation for this class was generated from the following files: