Template Class VoxelGrid
Defined in File bonxai.hpp
Nested Relationships
Nested Types
Class Documentation
-
template<typename DataT>
class VoxelGrid Public Types
Public Functions
-
inline VoxelGrid(double voxel_size, uint8_t inner_bits = 2, uint8_t leaf_bits = 3)
VoxelGrid constructor.
-
inline size_t memUsage() const
getMemoryUsage returns the amount of bytes used by this data structure
-
inline size_t activeCellsCount() const
Return the total number of active cells.
-
inline CoordT posToCoord(double x, double y, double z)
posToCoord is used to convert real coordinates to CoordT indexes.
-
inline CoordT posToCoord(const Point3D &pos)
posToCoord is used to convert real coordinates to CoordT indexes.
-
template<class VisitorFunction>
inline void forEachCell(VisitorFunction func) forEachCell apply a function of type:
to each active element of the grid.void(DataT*, const CoordT&)
Public Members
-
const uint32_t INNER_BITS
-
const uint32_t LEAF_BITS
-
const uint32_t Log2N
-
const double resolution
-
const double inv_resolution
-
const uint32_t INNER_MASK
-
const uint32_t LEAF_MASK
-
class 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::greateAccessor()
Public Functions
-
inline bool setValue(const CoordT &coord, const DataT &value)
setValue of a cell. If the cell did not exist, it is created.
- Parameters:
coord – coordinate of the cell
value – value to set.
- Returns:
the previous state of the cell (ON = true).
-
inline DataT *value(const CoordT &coord, bool create_if_missing = false)
value getter.
- Parameters:
coord – coordinate of the cell.
- Returns:
return the pointer to the value or nullptr if not set.
-
inline 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:
coord – coordinate of the cell.
default_value – default value of the cell. Use only if the cell did not exist before.
- Returns:
the previous state of the cell (ON = true).
-
inline bool setCellOff(const CoordT &coord)
setCellOff will disable a cell without deleting its content.
- Parameters:
coord – coordinate of the cell.
- Returns:
the previous state of the cell (ON = true).
-
inline const InnerGrid *lastInnerdGrid() const
lastInnerdGrid returns the pointer to the InnerGrid in the cache.
-
inline const LeafGrid *lastLeafGrid() const
lastLeafGrid returns the pointer to the LeafGrid in the cache.
-
inline LeafGrid *getLeafGrid(const CoordT &coord, bool create_if_missing = false)
getLeafGrid gets the pointer to the LeafGrid containing the cell. It is the basic class used by setValue() and value().
- Parameters:
coord – Coordinate of the cell.
create_if_missing – if true, create the Root, Inner and Leaf, if not present.
-
inline bool setValue(const CoordT &coord, const DataT &value)
-
inline VoxelGrid(double voxel_size, uint8_t inner_bits = 2, uint8_t leaf_bits = 3)