|
|
A 3D grid of voxels of type _VoxelT. More...
#include <VisionX/libraries/VoxelGridCore/VoxelGrid.hpp>
Inheritance diagram for VoxelGrid< _VoxelT >:Public Types | |
| using | VoxelT = _VoxelT |
| The voxel type. More... | |
Public Member Functions | |
| std::vector< VoxelT >::iterator | begin () |
| Get an iterator to the first voxel. More... | |
| std::vector< VoxelT >::const_iterator | begin () const |
| Get an iterator to the first voxel. More... | |
| std::vector< VoxelT >::const_iterator | cbegin () const |
| Get an iterator to the first voxel. More... | |
| std::vector< VoxelT >::const_iterator | cend () const |
| Get an iterator to the element following the last voxel. More... | |
| void | checkIsInside (const Eigen::Vector3i &index) const |
| Assert that the given index is a valid grid index. More... | |
| std::vector< VoxelT >::iterator | end () |
| Get an iterator to the element following the last voxel. More... | |
| std::vector< VoxelT >::const_iterator | end () const |
| Get an iterator to the element following the last voxel. More... | |
| Eigen::Vector3f | getCenter () const |
| Get the geometric center of the grid the world frame (which differs from the origin for even grid sizes). More... | |
| Eigen::Matrix4f | getCenterPose () const |
| Get the grid pose positioned at the grid center in the world frame. More... | |
| Eigen::Vector3f | getExtents () const |
| Get extent of the grid along each axis (encompassing the whole voxels). More... | |
| Eigen::Vector3f | getExtentsOfCenters () const |
| Get extent of the grid along each axis (encompassing only voxel centers). More... | |
| Eigen::Vector3i | getGridSizes () const |
| Get the grid size. More... | |
| Eigen::Matrix32f | getLocalBoundingBox () const |
| Get the local axis aligned bounding box of the grid (minimal/maximal values in columns). More... | |
| Eigen::Matrix32f | getLocalBoundingBoxOfCenters () const |
| Get the local axis aligned bounding box of the voxel centers (minimal/maximal values in columns). More... | |
| std::size_t | getNumVoxels () const |
| Get the number of voxels in the grid. More... | |
| Eigen::Quaternionf | getOrientation () const |
| Get the grid orienation in the world frame. More... | |
| Eigen::Vector3f | getOrigin () const |
| Get the grid origin in the world frame (center of voxel [0 0 0]). More... | |
| Eigen::Matrix4f | getPose () const |
| Get the grid pose in the world frame. More... | |
| VoxelGridStructure | getStructure () const |
| Get the voxel grid structure. More... | |
| VoxelT & | getVoxel (const Eigen::Vector3f &point, bool local=false) |
| Get the voxel closest to the given point. More... | |
| const VoxelT & | getVoxel (const Eigen::Vector3f &point, bool local=false) const |
| VoxelT & | getVoxel (const Eigen::Vector3i &index) |
| Get the voxel with the given grid index. More... | |
| const VoxelT & | getVoxel (const Eigen::Vector3i &index) const |
| VoxelT & | getVoxel (int x, int y, int z) |
| Get the voxel with the given grid index. More... | |
| const VoxelT & | getVoxel (int x, int y, int z) const |
| VoxelT & | getVoxel (std::size_t index) |
| Get the voxel with the given index. More... | |
| const VoxelT & | getVoxel (std::size_t index) const |
| Eigen::Vector3f | getVoxelCenter (const Eigen::Vector3i &index, bool local=false) const |
| Get the center of the voxel with the given index. More... | |
| Eigen::Vector3f | getVoxelCenter (int x, int y, int z, bool local=false) const |
| Get the center of the voxel with the given index. More... | |
| Eigen::Vector3f | getVoxelCenter (std::size_t index, bool local=false) const |
| Get the center of the voxel with the given index. More... | |
| std::size_t | getVoxelFlatIndex (const Eigen::Vector3f &point, bool local=false) const |
Get the flat index of the voxel closest to point. More... | |
| std::size_t | getVoxelFlatIndex (const Eigen::Vector3i &index) const |
| Get the flat index of the voxel with given grid index. More... | |
| std::size_t | getVoxelFlatIndex (int x, int y, int z) const |
| Get the flat index of the voxel with given grid index. More... | |
| Eigen::Vector3i | getVoxelGridIndex (const Eigen::Vector3f &point, bool local=false) const |
| Get the grid index of the voxel closest to point. More... | |
| Eigen::Vector3i | getVoxelGridIndex (size_t index) const |
| Get the grid index of the voxel with the given flat index. More... | |
| Eigen::Vector3i | getVoxelGridIndexMax () const |
| Get the maximal (along each axis) voxel grid index. More... | |
| Eigen::Vector3i | getVoxelGridIndexMin () const |
| Get the minimal (along each axis) voxel grid index. More... | |
| const std::vector< VoxelT > & | getVoxels () const |
| Get the voxels. More... | |
| Eigen::Vector3f | getVoxelSizes () const |
| Get the voxel size. More... | |
| bool | isInside (const Eigen::Vector3f &point, bool local=false) const |
| Indicate whether the given point is inside the voxel. More... | |
| bool | isInside (const Eigen::Vector3i &index) const |
| Indicate whether the given point is inside the voxel. More... | |
| std::size_t | numVoxels () const |
| Get the number of voxels in the grid. More... | |
| VoxelT & | operator[] (const Eigen::Vector3i &index) |
| Get the voxel with given grid index. More... | |
| const VoxelT & | operator[] (const Eigen::Vector3i &index) const |
| VoxelT & | operator[] (std::size_t index) |
| Get the voxel with given flat index. More... | |
| const VoxelT & | operator[] (std::size_t index) const |
| void | reset (const VoxelT &value={}) |
Reset the voxel data by numVoxels() voxels with given value. More... | |
| void | resetStructure (const VoxelGridStructure &structure) |
| Set the voxel grid structure and reset voxel data. More... | |
| void | setCenter (const Eigen::Vector3f &value) |
| Set the geometric center of the grid the world frame (which differs from the origin for even grid sizes). More... | |
| void | setCenterPose (const Eigen::Matrix4f &value) |
| Set the grid pose so that the grid center is the position of the given pose under the given orientation. More... | |
| void | setGridSizes (const Eigen::Vector3i &gridSizes) |
| Set the grid size. This resets the grid data. More... | |
| void | setGridSizes (float gridSizes) |
| Set the grid size for a cubic grid. Resets the grid data. More... | |
| void | setOrientation (const Eigen::Quaternionf &value) |
| Set the grid orienation in the world frame. More... | |
| void | setOrigin (const Eigen::Vector3f &value) |
| Set the grid origin the world frame (center of voxel [0 0 0]). More... | |
| void | setPose (const Eigen::Matrix4f &value) |
| Get the grid pose in the world frame. More... | |
| void | setVoxels (const std::vector< VoxelT > &voxels) |
| Set the voxels. More... | |
| void | setVoxelSizes (const Eigen::Vector3f &voxelSizes) |
| Set the voxel size. The grid data is not updated. More... | |
| void | setVoxelSizes (float voxelSize) |
| Set the voxel size of cubic voxels. The grid data is not updated. More... | |
| VoxelGrid () | |
| Construct a voxel grid with 0 voxels of size 1.0. More... | |
| template<typename OtherVoxelT > | |
| VoxelGrid (const VoxelGrid< OtherVoxelT > &other) | |
| Construct a voxel grid with the same structure as other. More... | |
| VoxelGrid (const VoxelGrid< VoxelT > &other)=default | |
| Ordinary copy constructor for voxel grid with same VoxelT. More... | |
| VoxelGrid (const VoxelGridStructure &structure, const std::vector< VoxelGrid::VoxelT > &voxelData) | |
| Construct a voxel grid with the given structure and data. More... | |
| VoxelGrid (const VoxelGridStructure &structure, const VoxelT &value={}) | |
| Construct a voxel grid with the given structure and voxels with given value. More... | |
Protected Attributes | |
| VoxelGridStructure | _struct |
| The geometric structure. More... | |
| std::vector< VoxelT > | _voxels |
| The voxel data. More... | |
Friends | |
| template<class VoxelType > | |
| std::ostream & | operator<< (std::ostream &os, const VoxelGrid< VoxelType > &grid) |
| Stream a human-readable description of the grid's structure. More... | |
A 3D grid of voxels of type _VoxelT.
A VoxelGrid three-dimensional regular grid of cuboids, called voxels. Its geometric structure is defined by a VoxelGridStructure. In addition, it stores voxel data of type _VoxelT (one per voxel).
This is a generic implementation made to hold hold arbitrary data. As such, there is no concept of "free/occupied" voxels".
Definition at line 49 of file VoxelGrid.hpp.
| using VoxelT = _VoxelT |
The voxel type.
Definition at line 53 of file VoxelGrid.hpp.
Construct a voxel grid with 0 voxels of size 1.0.
Definition at line 524 of file VoxelGrid.hpp.
| VoxelGrid | ( | const VoxelGridStructure & | structure, |
| const VoxelT & | value = {} |
||
| ) |
Construct a voxel grid with the given structure and voxels with given value.
Definition at line 529 of file VoxelGrid.hpp.
| VoxelGrid | ( | const VoxelGridStructure & | structure, |
| const std::vector< VoxelGrid< _VoxelT >::VoxelT > & | voxelData | ||
| ) |
Construct a voxel grid with the given structure and data.
The size of voxelData must match the grid size of structure.
| error::InvalidVoxelDataSize | If the size does not match. |
Definition at line 535 of file VoxelGrid.hpp.
Construct a voxel grid with the same structure as other.
Definition at line 548 of file VoxelGrid.hpp.
Ordinary copy constructor for voxel grid with same VoxelT.
|
inline |
Get an iterator to the first voxel.
Definition at line 469 of file VoxelGrid.hpp.
|
inline |
Get an iterator to the first voxel.
Definition at line 476 of file VoxelGrid.hpp.
|
inline |
Get an iterator to the first voxel.
Definition at line 483 of file VoxelGrid.hpp.
|
inline |
Get an iterator to the element following the last voxel.
Definition at line 504 of file VoxelGrid.hpp.
|
inline |
Assert that the given index is a valid grid index.
Definition at line 436 of file VoxelGrid.hpp.
|
inline |
Get an iterator to the element following the last voxel.
Definition at line 490 of file VoxelGrid.hpp.
|
inline |
Get an iterator to the element following the last voxel.
Definition at line 497 of file VoxelGrid.hpp.
|
inline |
Get the geometric center of the grid the world frame (which differs from the origin for even grid sizes).
Definition at line 338 of file VoxelGrid.hpp.
|
inline |
Get the grid pose positioned at the grid center in the world frame.
Definition at line 379 of file VoxelGrid.hpp.
|
inline |
Get extent of the grid along each axis (encompassing the whole voxels).
Definition at line 394 of file VoxelGrid.hpp.
|
inline |
Get extent of the grid along each axis (encompassing only voxel centers).
Definition at line 401 of file VoxelGrid.hpp.
|
inline |
Get the grid size.
Definition at line 189 of file VoxelGrid.hpp.
Here is the caller graph for this function:
|
inline |
Get the local axis aligned bounding box of the grid (minimal/maximal values in columns).
Definition at line 408 of file VoxelGrid.hpp.
Here is the caller graph for this function:
|
inline |
Get the local axis aligned bounding box of the voxel centers (minimal/maximal values in columns).
Definition at line 415 of file VoxelGrid.hpp.
|
inline |
Get the number of voxels in the grid.
Definition at line 182 of file VoxelGrid.hpp.
Here is the caller graph for this function:
|
inline |
Get the grid orienation in the world frame.
Definition at line 321 of file VoxelGrid.hpp.
Here is the caller graph for this function:
|
inline |
Get the grid origin in the world frame (center of voxel [0 0 0]).
Note that this differs from the geometric center for even grid sizes.
Definition at line 305 of file VoxelGrid.hpp.
Here is the caller graph for this function:
|
inline |
Get the grid pose in the world frame.
Note that this differs from the geometric center for even grid sizes.
Definition at line 363 of file VoxelGrid.hpp.
Here is the caller graph for this function:
|
inline |
Get the voxel grid structure.
Definition at line 87 of file VoxelGrid.hpp.
Here is the caller graph for this function:
|
inline |
Get the voxel closest to the given point.
| local | If false (default), the point is transformed to local coordinate system. |
Definition at line 142 of file VoxelGrid.hpp.
|
inline |
Definition at line 148 of file VoxelGrid.hpp.
|
inline |
Get the voxel with the given grid index.
operator[] Definition at line 128 of file VoxelGrid.hpp.
|
inline |
Definition at line 134 of file VoxelGrid.hpp.
|
inline |
Get the voxel with the given grid index.
operator[] Definition at line 115 of file VoxelGrid.hpp.
|
inline |
Definition at line 121 of file VoxelGrid.hpp.
|
inline |
Get the voxel with the given index.
operator[] Definition at line 102 of file VoxelGrid.hpp.
Here is the caller graph for this function:
|
inline |
Definition at line 108 of file VoxelGrid.hpp.
|
inline |
Get the center of the voxel with the given index.
Definition at line 296 of file VoxelGrid.hpp.
|
inline |
Get the center of the voxel with the given index.
Definition at line 289 of file VoxelGrid.hpp.
|
inline |
Get the center of the voxel with the given index.
Definition at line 282 of file VoxelGrid.hpp.
Here is the caller graph for this function:
|
inline |
Get the flat index of the voxel closest to point.
Definition at line 246 of file VoxelGrid.hpp.
|
inline |
Get the flat index of the voxel with given grid index.
Definition at line 239 of file VoxelGrid.hpp.
|
inline |
Get the flat index of the voxel with given grid index.
Definition at line 232 of file VoxelGrid.hpp.
Here is the caller graph for this function:
|
inline |
Get the grid index of the voxel closest to point.
| local | If false (default), the point is transformed to local coordinate system. |
Definition at line 261 of file VoxelGrid.hpp.
|
inline |
Get the grid index of the voxel with the given flat index.
Definition at line 253 of file VoxelGrid.hpp.
Here is the caller graph for this function:
|
inline |
Get the maximal (along each axis) voxel grid index.
Definition at line 275 of file VoxelGrid.hpp.
Here is the caller graph for this function:
|
inline |
Get the minimal (along each axis) voxel grid index.
Definition at line 268 of file VoxelGrid.hpp.
Here is the caller graph for this function:
|
inline |
Get the voxels.
Definition at line 156 of file VoxelGrid.hpp.
Here is the caller graph for this function:
|
inline |
Get the voxel size.
Definition at line 211 of file VoxelGrid.hpp.
Here is the caller graph for this function:
|
inline |
Indicate whether the given point is inside the voxel.
Definition at line 429 of file VoxelGrid.hpp.
|
inline |
Indicate whether the given point is inside the voxel.
Definition at line 422 of file VoxelGrid.hpp.
|
inline |
Get the number of voxels in the grid.
Definition at line 175 of file VoxelGrid.hpp.
Here is the caller graph for this function:
|
inline |
Get the voxel with given grid index.
getVoxel(const Eigen::Vector3i&) Definition at line 456 of file VoxelGrid.hpp.
|
inline |
Definition at line 462 of file VoxelGrid.hpp.
|
inline |
Get the voxel with given flat index.
getVoxel(std::size_t) Definition at line 443 of file VoxelGrid.hpp.
|
inline |
Definition at line 449 of file VoxelGrid.hpp.
|
inline |
Reset the voxel data by numVoxels() voxels with given value.
Definition at line 80 of file VoxelGrid.hpp.
Here is the caller graph for this function:
|
inline |
Set the voxel grid structure and reset voxel data.
Definition at line 94 of file VoxelGrid.hpp.
Here is the caller graph for this function:
|
inline |
Set the geometric center of the grid the world frame (which differs from the origin for even grid sizes).
setCenterPose().Definition at line 354 of file VoxelGrid.hpp.
|
inline |
Set the grid pose so that the grid center is the position of the given pose under the given orientation.
Definition at line 387 of file VoxelGrid.hpp.
|
inline |
Set the grid size. This resets the grid data.
Definition at line 203 of file VoxelGrid.hpp.
|
inline |
Set the grid size for a cubic grid. Resets the grid data.
Definition at line 196 of file VoxelGrid.hpp.
Here is the caller graph for this function:
|
inline |
Set the grid orienation in the world frame.
Definition at line 328 of file VoxelGrid.hpp.
Here is the caller graph for this function:
|
inline |
Set the grid origin the world frame (center of voxel [0 0 0]).
Note that this differs from the geometric center for even grid sizes.
Definition at line 314 of file VoxelGrid.hpp.
Here is the caller graph for this function:
|
inline |
Get the grid pose in the world frame.
Note that this differs from the geometric center for even grid sizes.
Definition at line 372 of file VoxelGrid.hpp.
|
inline |
Set the voxels.
(Size must match numVoxels()).
| error::InvalidVoxelDataSize | If the size does not match. |
Definition at line 164 of file VoxelGrid.hpp.
Here is the caller graph for this function:
|
inline |
Set the voxel size. The grid data is not updated.
Definition at line 225 of file VoxelGrid.hpp.
|
inline |
Set the voxel size of cubic voxels. The grid data is not updated.
Definition at line 218 of file VoxelGrid.hpp.
Here is the caller graph for this function:
|
friend |
Stream a human-readable description of the grid's structure.
|
protected |
The geometric structure.
Definition at line 517 of file VoxelGrid.hpp.
|
protected |
The voxel data.
Definition at line 520 of file VoxelGrid.hpp.