![]() |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
Simple 3D grid structure. More...
#include <Grid3D.h>
Classes | |
| struct | CellToTest |
Public Types | |
| using | GridElement = Type |
| Cell type. More... | |
| using | genericCellTriIntersectionAction = std::function< void(const Tuple3i &, unsigned)> |
Public Member Functions | |
| Grid3D () | |
| Default constructor. More... | |
| const Tuple3ui & | size () const |
| Returns the grid dimensions. More... | |
| bool | isInitialized () const |
| Returns whether the grid has been initialized or not. More... | |
| void | clear () |
| Clears the grid. More... | |
| bool | init (unsigned di, unsigned dj, unsigned dk, unsigned margin, GridElement defaultCellValue=0) |
| Initializes the grid. More... | |
| Tuple3i | computeCellPos (const CCVector3 &P, const CCVector3 &gridMinCorner, PointCoordinateType cellSize) const |
| Computes the (grid) cell position that contains a given point. More... | |
| bool | intersectWith (GenericIndexedMesh *mesh, PointCoordinateType cellLength, const CCVector3 &gridMinCorner, GridElement intersectValue=0, GenericProgressCallback *progressCb=nullptr) |
| Intersects this grid with a mesh. More... | |
| bool | intersectWith (GenericIndexedMesh *mesh, PointCoordinateType cellLength, const CCVector3 &gridMinCorner, genericCellTriIntersectionAction action, GenericProgressCallback *progressCb=nullptr) |
| Intersects this grid with a mesh (generic form) More... | |
| bool | intersectWith (GenericCloud *cloud, PointCoordinateType cellLength, const CCVector3 &gridMinCorner, GridElement intersectValue=0, GenericProgressCallback *progressCb=nullptr) |
| Intersects this grid with a cloud. More... | |
| void | setValue (int i, int j, int k, GridElement value) |
| Sets the value of a given cell. More... | |
| void | setValue (const Tuple3i &cellPos, GridElement value) |
| Sets the value of a given cell. More... | |
| const GridElement & | getValue (int i, int j, int k) const |
| Returns the value of a given cell (const version) More... | |
| GridElement & | getValue (int i, int j, int k) |
| Returns the value of a given cell. More... | |
| const GridElement & | getValue (Tuple3i &cellPos) const |
| Returns the value of a given cell const version) More... | |
| GridElement & | getValue (Tuple3i &cellPos) |
| Returns the value of a given cell. More... | |
| GridElement * | data () |
| Gives access to the internal grid data (with margin) More... | |
| const GridElement * | data () const |
| Gives access to the internal grid data (with margin) (const version) More... | |
| uint64_t | innerCellCount () const |
| Returns the number of cell count (whithout margin) More... | |
| uint64_t | totalCellCount () const |
| Returns the total number of cell count (with margin) More... | |
Protected Member Functions | |
| int64_t | pos2index (int i, int j, int k) const |
| Converts a 3D position to an absolute index. More... | |
Protected Attributes | |
| std::vector< GridElement > | m_grid |
| Grid data. More... | |
| Tuple3ui | m_innerSize |
| Dimensions of the grid (without margin) More... | |
| int64_t | m_margin |
| Margin. More... | |
| int64_t | m_rowSize |
| 1D row size (with margin) More... | |
| int64_t | m_sliceSize |
| 2D slice size (with margin) More... | |
| uint64_t | m_innerCellCount |
| 3D grid size without margin More... | |
| uint64_t | m_totalCellCount |
| 3D grid size with margin More... | |
| int64_t | m_marginShift |
| First index of real data (i.e. after marin) More... | |
Simple 3D grid structure.
The grid data is contiguous in memory.
| using cloudViewer::Grid3D< Type >::genericCellTriIntersectionAction = std::function<void(const Tuple3i&, unsigned)> |
Generic function applied to a cell intersected by a triangle (used by the generic form of intersectWith)
| using cloudViewer::Grid3D< Type >::GridElement = Type |
Cell type.
|
inline |
Default constructor.
|
inline |
Clears the grid.
|
inline |
Computes the (grid) cell position that contains a given point.
Referenced by cloudViewer::Grid3D< unsigned >::intersectWith().
|
inline |
Gives access to the internal grid data (with margin)
Referenced by cloudViewer::SaitoSquaredDistanceTransform::SDT_2D(), and cloudViewer::SaitoSquaredDistanceTransform::SDT_3D().
|
inline |
Gives access to the internal grid data (with margin) (const version)
|
inline |
Returns the value of a given cell.
| i | the cell coordinate along the X dimension |
| j | the cell coordinate along the Y dimension |
| k | the cell coordinate along the Z dimension |
|
inline |
Returns the value of a given cell (const version)
| i | the cell coordinate along the X dimension |
| j | the cell coordinate along the Y dimension |
| k | the cell coordinate along the Z dimension |
Referenced by cloudViewer::DistanceComputationTools::computeApproxCloud2CloudDistance(), cloudViewer::DistanceComputationTools::computeCloud2MeshDistancesWithOctree(), and cloudViewer::DistanceComputationTools::computeCloud2MeshDistanceWithOctree().
|
inline |
Returns the value of a given cell.
| cellPos | the cell position |
|
inline |
Returns the value of a given cell const version)
| cellPos | the cell position |
|
inline |
Initializes the grid.
The grid must be explicitelty initialized prior to any action.
| di | grid size along the X dimension |
| dj | grid size along the Y dimension |
| dk | grid size along the Z dimension |
| margin | grid margin |
| defaultCellValue | default cell value |
Referenced by cloudViewer::ChamferDistanceTransform::init(), and cloudViewer::SaitoSquaredDistanceTransform::initGrid().
|
inline |
Returns the number of cell count (whithout margin)
|
inline |
Intersects this grid with a cloud.
|
inline |
Intersects this grid with a mesh (generic form)
|
inline |
Intersects this grid with a mesh.
Referenced by cloudViewer::Grid3D< unsigned >::intersectWith().
|
inline |
Returns whether the grid has been initialized or not.
Referenced by cloudViewer::Grid3D< unsigned >::intersectWith().
|
inlineprotected |
Converts a 3D position to an absolute index.
Referenced by cloudViewer::Grid3D< unsigned >::getValue(), and cloudViewer::Grid3D< unsigned >::setValue().
|
inline |
Sets the value of a given cell.
| cellPos | the cell position |
| value | new cell value |
|
inline |
Sets the value of a given cell.
| i | the cell coordinate along the X dimension |
| j | the cell coordinate along the Y dimension |
| k | the cell coordinate along the Z dimension |
| value | new cell value |
Referenced by cloudViewer::DistanceComputationTools::computeApproxCloud2CloudDistance(), cloudViewer::DistanceComputationTools::intersectMeshWithOctree(), and cloudViewer::Grid3D< unsigned >::intersectWith().
|
inline |
Returns the grid dimensions.
Referenced by cloudViewer::Grid3D< unsigned >::intersectWith(), cloudViewer::SaitoSquaredDistanceTransform::SDT_2D(), and cloudViewer::SaitoSquaredDistanceTransform::SDT_3D().
|
inline |
Returns the total number of cell count (with margin)
|
protected |
|
protected |
3D grid size without margin
Referenced by cloudViewer::Grid3D< unsigned >::clear(), cloudViewer::Grid3D< unsigned >::init(), and cloudViewer::Grid3D< unsigned >::innerCellCount().
|
protected |
Dimensions of the grid (without margin)
Referenced by cloudViewer::Grid3D< unsigned >::clear(), cloudViewer::Grid3D< unsigned >::init(), and cloudViewer::Grid3D< unsigned >::size().
|
protected |
Margin.
Referenced by cloudViewer::Grid3D< unsigned >::clear(), and cloudViewer::Grid3D< unsigned >::init().
|
protected |
First index of real data (i.e. after marin)
Referenced by cloudViewer::Grid3D< unsigned >::clear(), cloudViewer::Grid3D< unsigned >::init(), and cloudViewer::Grid3D< unsigned >::pos2index().
|
protected |
1D row size (with margin)
Referenced by cloudViewer::Grid3D< unsigned >::clear(), cloudViewer::Grid3D< unsigned >::init(), and cloudViewer::Grid3D< unsigned >::pos2index().
|
protected |
2D slice size (with margin)
Referenced by cloudViewer::Grid3D< unsigned >::clear(), cloudViewer::Grid3D< unsigned >::init(), and cloudViewer::Grid3D< unsigned >::pos2index().
|
protected |
3D grid size with margin
Referenced by cloudViewer::Grid3D< unsigned >::clear(), cloudViewer::Grid3D< unsigned >::init(), cloudViewer::Grid3D< unsigned >::isInitialized(), and cloudViewer::Grid3D< unsigned >::totalCellCount().