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

Basic node of Octree. More...

#include <Node.hpp>

Public Member Functions

 Node (int x, int y, int z, int size)
 Constructs Node with its properties. More...
 
 Node (Node const &other)
 Copy constructor. More...
 
virtual ~Node ()
 Destructor method. More...
 
int getSize () const
 Returns size of node. More...
 
int getX () const
 Returns x position of the node. More...
 
int getY () const
 Returns y position of the node. More...
 
int getZ () const
 Returns z position of the node. More...
 
int getNbChildren () const
 Returns the number of children, [0, 8]. More...
 
std::array< T_Node *, 8 > const & getChildren () const
 Returns the children array. More...
 
T_Node * getParent () const
 Returns the parent node. More...
 
Octree< T_Node > * getOctree () const
 Returns the octree. More...
 
bool empty () const
 Check if node has children. More...
 
bool operator== (Node const &other) const
 Compare coordinate and size of the node. More...
 
bool operator!= (Node const &other) const
 Compare coordinate and size of the node. More...
 
void merge (T_Node const &other)
 Merge method of the node, do nothing. More...
 
T_Node * findNode (int x, int y, int z, int size) const
 Find node. More...
 
T_Node * getChild (int x, int y, int z) const
 Get the child node that can contain the point at coordinate xyz. More...
 
int getChildPos (int x, int y, int z) const
 Get the child node position that can contain the point at coordinate xyz. More...
 
uint8_t getChildId () const
 
template<typename T >
bool isInside (T x, T y, T z, T sx, T sy, T sz) const
 Check if box is inside the node. More...
 
template<typename T >
bool isInside (T x, T y, T z) const
 Check if point is inside the node. More...
 
template<typename T >
bool isInside (T x, T y, T z, T size) const
 Check if box is inside the node. More...
 
bool isInside (T_Node &node) const
 Check if node is inside the node. More...
 

Protected Member Functions

void changeOctree (Octree< T_Node > &octree)
 Change octree of the node and all its children. More...
 

Protected Attributes

std::array< T_Node *, 8 > _children
 Array of children. More...
 
T_Node * _parent = nullptr
 Parent node. More...
 
Octree< T_Node > * _octree = nullptr
 Parent octree. More...
 
int _x = 0
 X coordinate. More...
 
int _y = 0
 Y coordinate. More...
 
int _z = 0
 Z coordinate. More...
 
int _size = 0
 Size of the node. More...
 
uint8_t _childId = 0
 Child id inside parent's children array. More...
 
uint8_t _nbChildren = 0
 Number of node inside the children array. More...
 
friend Octree< T_Node >
 

Detailed Description

template<typename T_Node>
class voxomap::Node< T_Node >

Basic node of Octree.

Definition at line 17 of file Node.hpp.

Constructor & Destructor Documentation

◆ Node() [1/2]

template<typename T_Node >
voxomap::Node< T_Node >::Node ( int  x,
int  y,
int  z,
int  size 
)

Constructs Node with its properties.

Parameters
xX coordinate
yY coordinate
zZ coordinate
sizeSize of the node

◆ Node() [2/2]

template<typename T_Node >
voxomap::Node< T_Node >::Node ( Node< T_Node > const &  other)

Copy constructor.

◆ ~Node()

template<typename T_Node >
virtual voxomap::Node< T_Node >::~Node ( )
virtual

Destructor method.

Member Function Documentation

◆ getSize()

template<typename T_Node >
int voxomap::Node< T_Node >::getSize ( ) const

Returns size of node.

◆ getX()

template<typename T_Node >
int voxomap::Node< T_Node >::getX ( ) const

Returns x position of the node.

◆ getY()

template<typename T_Node >
int voxomap::Node< T_Node >::getY ( ) const

Returns y position of the node.

◆ getZ()

template<typename T_Node >
int voxomap::Node< T_Node >::getZ ( ) const

Returns z position of the node.

◆ getNbChildren()

template<typename T_Node >
int voxomap::Node< T_Node >::getNbChildren ( ) const

Returns the number of children, [0, 8].

◆ getChildren()

template<typename T_Node >
std::array<T_Node*, 8> const& voxomap::Node< T_Node >::getChildren ( ) const

Returns the children array.

◆ getParent()

template<typename T_Node >
T_Node* voxomap::Node< T_Node >::getParent ( ) const

Returns the parent node.

◆ getOctree()

template<typename T_Node >
Octree<T_Node>* voxomap::Node< T_Node >::getOctree ( ) const

Returns the octree.

◆ empty()

template<typename T_Node >
bool voxomap::Node< T_Node >::empty ( ) const

Check if node has children.

Returns
True if there is no children

◆ operator==()

template<typename T_Node >
bool voxomap::Node< T_Node >::operator== ( Node< T_Node > const &  other) const

Compare coordinate and size of the node.

Returns
True if this is similar to other

◆ operator!=()

template<typename T_Node >
bool voxomap::Node< T_Node >::operator!= ( Node< T_Node > const &  other) const

Compare coordinate and size of the node.

Returns
True if this is different to other

◆ merge()

template<typename T_Node >
void voxomap::Node< T_Node >::merge ( T_Node< T_Node > const &  other)

Merge method of the node, do nothing.

◆ findNode()

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

Find node.

Parameters
xX coordinate
yY coordinate
zZ coordinate
sizeSize of the node
Returns
True if this is different to other

◆ getChild()

template<typename T_Node >
T_Node* voxomap::Node< T_Node >::getChild ( int  x,
int  y,
int  z 
) const

Get the child node that can contain the point at coordinate xyz.

Parameters
xX coordinate
yY coordinate
zZ coordinate
Returns
The child node, nullptr if doesn't exist

◆ getChildPos()

template<typename T_Node >
int voxomap::Node< T_Node >::getChildPos ( int  x,
int  y,
int  z 
) const

Get the child node position that can contain the point at coordinate xyz.

Parameters
xX coordinate
yY coordinate
zZ coordinate
Returns
The index of children

◆ getChildId()

template<typename T_Node >
uint8_t voxomap::Node< T_Node >::getChildId ( ) const
Returns
The child id of this, inside the children array of the parent

◆ isInside() [1/4]

template<typename T_Node >
template<typename T >
bool voxomap::Node< T_Node >::isInside ( x,
y,
z,
sx,
sy,
sz 
) const

Check if box is inside the node.

Parameters
xX coordinate of the box
yY coordinate of the box
zZ coordinate of the box
sxSize on x axis of the box
sySize on y axis of the box
szSize on z axis of the box
Returns
True if the box is inside

◆ isInside() [2/4]

template<typename T_Node >
template<typename T >
bool voxomap::Node< T_Node >::isInside ( x,
y,
z 
) const

Check if point is inside the node.

Parameters
xX coordinate
yY coordinate
zZ coordinate
Returns
True if the point is inside

◆ isInside() [3/4]

template<typename T_Node >
template<typename T >
bool voxomap::Node< T_Node >::isInside ( x,
y,
z,
size 
) const

Check if box is inside the node.

Parameters
xX coordinate
yY coordinate
zZ coordinate
sizeSize of the box
Returns
True if the box is inside

◆ isInside() [4/4]

template<typename T_Node >
bool voxomap::Node< T_Node >::isInside ( T_Node< T_Node > &  node) const

Check if node is inside the node.

Parameters
nodeThe node
Returns
True if the node can be inside this

◆ changeOctree()

template<typename T_Node >
void voxomap::Node< T_Node >::changeOctree ( Octree< T_Node< T_Node > > &  octree)
protected

Change octree of the node and all its children.

Parameters
octreeReference to the octree

Member Data Documentation

◆ _children

template<typename T_Node >
std::array<T_Node*, 8> voxomap::Node< T_Node >::_children
protected

Array of children.

Definition at line 166 of file Node.hpp.

◆ _parent

template<typename T_Node >
T_Node* voxomap::Node< T_Node >::_parent = nullptr
protected

Parent node.

Definition at line 167 of file Node.hpp.

◆ _octree

template<typename T_Node >
Octree<T_Node>* voxomap::Node< T_Node >::_octree = nullptr
protected

Parent octree.

Definition at line 168 of file Node.hpp.

◆ _x

template<typename T_Node >
int voxomap::Node< T_Node >::_x = 0
protected

X coordinate.

Definition at line 169 of file Node.hpp.

◆ _y

template<typename T_Node >
int voxomap::Node< T_Node >::_y = 0
protected

Y coordinate.

Definition at line 170 of file Node.hpp.

◆ _z

template<typename T_Node >
int voxomap::Node< T_Node >::_z = 0
protected

Z coordinate.

Definition at line 171 of file Node.hpp.

◆ _size

template<typename T_Node >
int voxomap::Node< T_Node >::_size = 0
protected

Size of the node.

Definition at line 172 of file Node.hpp.

◆ _childId

template<typename T_Node >
uint8_t voxomap::Node< T_Node >::_childId = 0
protected

Child id inside parent's children array.

Definition at line 173 of file Node.hpp.

◆ _nbChildren

template<typename T_Node >
uint8_t voxomap::Node< T_Node >::_nbChildren = 0
protected

Number of node inside the children array.

Definition at line 174 of file Node.hpp.

◆ Octree< T_Node >

template<typename T_Node >
friend voxomap::Node< T_Node >::Octree< T_Node >
protected

Definition at line 175 of file Node.hpp.


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