EasyNav Plugins
Loading...
Searching...
No Matches
VoxelGrid< DataT >::Accessor Class Reference

Class to be used to set and get values of a cell of the Grid. More...

#include <bonxai.hpp>

Inheritance diagram for VoxelGrid< DataT >::Accessor:
Collaboration diagram for VoxelGrid< DataT >::Accessor:

Public Member Functions

 Accessor (VoxelGrid &grid)
LeafGridgetLeafGrid (const CoordT &coord, bool create_if_missing=false)
 getLeafGrid gets the pointer to the LeafGrid containing the cell.
bool setCellOff (const CoordT &coord)
 setCellOff will disable a cell without deleting its content.
bool setCellOn (const CoordT &coord, const DataT &default_value=DataT())
 setCellOn is similar to setValue, but the value is changed only if the cell has been created, otherwise, the previous value is used.
bool setValue (const CoordT &coord, const DataT &value)
 setValue of a cell.
DataT * value (const CoordT &coord, bool create_if_missing=false)
 value getter.
Public Member Functions inherited from VoxelGrid< DataT >::ConstAccessor
 ConstAccessor (const VoxelGrid &grid)
const LeafGridgetLeafGrid (const CoordT &coord) const
bool isCellOn (const CoordT &coord) const
 isCellOn only check if a cell is in "On" state
const InnerGridlastInnerGrid () const
 lastInnerGrid returns the pointer to the InnerGrid in the cache.
const LeafGridlastLeafGrid () const
 lastLeafGrid returns the pointer to the LeafGrid in the cache.
const DataT * value (const CoordT &coord) const
 value getter.

Additional Inherited Members

Protected Attributes inherited from VoxelGrid< DataT >::ConstAccessor
const VoxelGridgrid_
CoordT prev_inner_coord_ = {std::numeric_limits<int32_t>::max(), 0, 0}
const InnerGridprev_inner_ptr_ = nullptr
const LeafGridprev_leaf_ptr_ = nullptr
CoordT prev_root_coord_ = {std::numeric_limits<int32_t>::max(), 0, 0}

Detailed Description

template<typename DataT>
class Bonxai::VoxelGrid< DataT >::Accessor

Class to be used to set and get values of a cell of the Grid.

It uses caching to speed up computation.

Create an instance of this object with the method VoxelGrid::createAccessor()

Constructor & Destructor Documentation

◆ Accessor()

template<typename DataT>
Accessor ( VoxelGrid & grid)

Member Function Documentation

◆ getLeafGrid()

template<typename DataT>
VoxelGrid< DataT >::LeafGrid * getLeafGrid ( const CoordT & coord,
bool create_if_missing = false )
nodiscard

getLeafGrid gets the pointer to the LeafGrid containing the cell.

It is the basic class used by setValue() and value().

Parameters
coordCoordinate of the cell.
create_if_missingif true, create the Root, Inner and Leaf, if not present.

◆ setCellOff()

template<typename DataT>
bool setCellOff ( const CoordT & coord)

setCellOff will disable a cell without deleting its content.

Parameters
coordcoordinate of the cell.
Returns
the previous state of the cell (ON = true).

◆ setCellOn()

template<typename DataT>
bool setCellOn ( const CoordT & coord,
const DataT & default_value = DataT() )

setCellOn is similar to setValue, but the value is changed only if the cell has been created, otherwise, the previous value is used.

Parameters
coordcoordinate of the cell.
default_valuedefault value of the cell. Use only if the cell did not exist before.
Returns
the previous state of the cell (ON = true).

◆ setValue()

template<typename DataT>
bool setValue ( const CoordT & coord,
const DataT & value )

setValue of a cell.

If the cell did not exist, it is created.

Parameters
coordcoordinate of the cell
valuevalue to set.
Returns
the previous state of the cell (ON = true).

◆ value()

template<typename DataT>
DataT * value ( const CoordT & coord,
bool create_if_missing = false )
nodiscard

value getter.

Parameters
coordcoordinate of the cell.
Returns
return the pointer to the value or nullptr if not set.

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