![]() |
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)> |
| using cloudViewer::Grid3D< Type >::GridElement = Type |
|
inline |
|
inline |
Clears the grid.
Definition at line 56 of file Grid3D.h.
References cloudViewer::Grid3D< Type >::m_grid, cloudViewer::Grid3D< Type >::m_innerCellCount, cloudViewer::Grid3D< Type >::m_innerSize, cloudViewer::Grid3D< Type >::m_margin, cloudViewer::Grid3D< Type >::m_marginShift, cloudViewer::Grid3D< Type >::m_rowSize, cloudViewer::Grid3D< Type >::m_sliceSize, and cloudViewer::Grid3D< Type >::m_totalCellCount.
|
inline |
Computes the (grid) cell position that contains a given point.
Definition at line 111 of file Grid3D.h.
References Tuple3Tpl< Type >::x, Tuple3Tpl< Type >::y, and Tuple3Tpl< Type >::z.
Referenced by cloudViewer::Grid3D< Type >::intersectWith().
|
inline |
Gives access to the internal grid data (with margin)
Definition at line 527 of file Grid3D.h.
References cloudViewer::Grid3D< Type >::m_grid.
Referenced by cloudViewer::SaitoSquaredDistanceTransform::SDT_2D(), and cloudViewer::SaitoSquaredDistanceTransform::SDT_3D().
|
inline |
Gives access to the internal grid data (with margin) (const version)
Definition at line 529 of file Grid3D.h.
References cloudViewer::Grid3D< Type >::m_grid.
|
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 |
Definition at line 507 of file Grid3D.h.
References cloudViewer::Grid3D< Type >::m_grid, and cloudViewer::Grid3D< Type >::pos2index().
|
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 |
Definition at line 498 of file Grid3D.h.
References cloudViewer::Grid3D< Type >::m_grid, and cloudViewer::Grid3D< Type >::pos2index().
Referenced by cloudViewer::DistanceComputationTools::computeApproxCloud2CloudDistance(), cloudViewer::DistanceComputationTools::computeCloud2MeshDistancesWithOctree(), and cloudViewer::DistanceComputationTools::computeCloud2MeshDistanceWithOctree().
|
inline |
Returns the value of a given cell.
| cellPos | the cell position |
Definition at line 522 of file Grid3D.h.
References cloudViewer::Grid3D< Type >::m_grid, cloudViewer::Grid3D< Type >::pos2index(), Tuple3Tpl< Type >::x, Tuple3Tpl< Type >::y, and Tuple3Tpl< Type >::z.
|
inline |
Returns the value of a given cell const version)
| cellPos | the cell position |
Definition at line 515 of file Grid3D.h.
References cloudViewer::Grid3D< Type >::m_grid, cloudViewer::Grid3D< Type >::pos2index(), Tuple3Tpl< Type >::x, Tuple3Tpl< Type >::y, and Tuple3Tpl< Type >::z.
|
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 |
Definition at line 77 of file Grid3D.h.
References cloudViewer::Grid3D< Type >::m_grid, cloudViewer::Grid3D< Type >::m_innerCellCount, cloudViewer::Grid3D< Type >::m_innerSize, cloudViewer::Grid3D< Type >::m_margin, cloudViewer::Grid3D< Type >::m_marginShift, cloudViewer::Grid3D< Type >::m_rowSize, cloudViewer::Grid3D< Type >::m_sliceSize, cloudViewer::Grid3D< Type >::m_totalCellCount, Tuple3Tpl< Type >::x, Tuple3Tpl< Type >::y, and Tuple3Tpl< Type >::z.
Referenced by cloudViewer::ChamferDistanceTransform::init(), and cloudViewer::SaitoSquaredDistanceTransform::initGrid().
|
inline |
Returns the number of cell count (whithout margin)
Definition at line 532 of file Grid3D.h.
References cloudViewer::Grid3D< Type >::m_innerCellCount.
|
inline |
Intersects this grid with a cloud.
Definition at line 423 of file Grid3D.h.
References cloudViewer::Grid3D< Type >::computeCellPos(), cloudViewer::GenericCloud::getNextPoint(), cloudViewer::Grid3D< Type >::isInitialized(), nProgress, cloudViewer::NormalizedProgress::oneStep(), cloudViewer::GenericCloud::placeIteratorAtBeginning(), cloudViewer::Grid3D< Type >::setValue(), cloudViewer::Grid3D< Type >::size(), cloudViewer::GenericCloud::size(), Tuple3Tpl< Type >::x, Tuple3Tpl< Type >::y, and Tuple3Tpl< Type >::z.
|
inline |
Intersects this grid with a mesh (generic form)
Definition at line 155 of file Grid3D.h.
References cloudViewer::GenericTriangle::_getA(), cloudViewer::GenericTriangle::_getB(), cloudViewer::GenericTriangle::_getC(), cloudViewer::GenericMesh::_getNextTriangle(), cloudViewer::utility::ceil(), cloudViewer::Grid3D< Type >::CellToTest::cellSize, cloudViewer::Grid3D< Type >::computeCellPos(), Vector3Tpl< Type >::cross(), Vector3Tpl< Type >::dot(), Vector3Tpl< PointCoordinateType >::fromArray(), cloudViewer::GreaterThanSquareEpsilon(), cloudViewer::Grid3D< Type >::isInitialized(), max(), min(), Vector3Tpl< Type >::norm2(), nProgress, cloudViewer::GenericMesh::placeIteratorAtBeginning(), cloudViewer::Grid3D< Type >::CellToTest::pos, cloudViewer::Grid3D< Type >::size(), cloudViewer::GenericMesh::size(), cloudViewer::CCMiscTools::TriBoxOverlap(), Tuple3Tpl< Type >::u, Tuple3Tpl< Type >::x, Tuple3Tpl< Type >::y, and Tuple3Tpl< Type >::z.
|
inline |
Intersects this grid with a mesh.
Definition at line 135 of file Grid3D.h.
References cloudViewer::Grid3D< Type >::setValue().
|
inline |
Returns whether the grid has been initialized or not.
Definition at line 51 of file Grid3D.h.
References cloudViewer::Grid3D< Type >::m_totalCellCount.
Referenced by cloudViewer::Grid3D< Type >::intersectWith().
|
inlineprotected |
Converts a 3D position to an absolute index.
Definition at line 538 of file Grid3D.h.
References cloudViewer::Grid3D< Type >::m_marginShift, cloudViewer::Grid3D< Type >::m_rowSize, and cloudViewer::Grid3D< Type >::m_sliceSize.
Referenced by cloudViewer::Grid3D< Type >::getValue(), and cloudViewer::Grid3D< Type >::setValue().
|
inline |
Sets the value of a given cell.
| cellPos | the cell position |
| value | new cell value |
Definition at line 488 of file Grid3D.h.
References cloudViewer::Grid3D< Type >::m_grid, cloudViewer::Grid3D< Type >::pos2index(), Tuple3Tpl< Type >::x, Tuple3Tpl< Type >::y, and Tuple3Tpl< Type >::z.
|
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 |
Definition at line 480 of file Grid3D.h.
References cloudViewer::Grid3D< Type >::m_grid, and cloudViewer::Grid3D< Type >::pos2index().
Referenced by cloudViewer::DistanceComputationTools::computeApproxCloud2CloudDistance(), cloudViewer::DistanceComputationTools::intersectMeshWithOctree(), and cloudViewer::Grid3D< Type >::intersectWith().
|
inline |
Returns the grid dimensions.
Definition at line 48 of file Grid3D.h.
References cloudViewer::Grid3D< Type >::m_innerSize.
Referenced by cloudViewer::Grid3D< Type >::intersectWith(), cloudViewer::SaitoSquaredDistanceTransform::SDT_2D(), and cloudViewer::SaitoSquaredDistanceTransform::SDT_3D().
|
inline |
Returns the total number of cell count (with margin)
Definition at line 534 of file Grid3D.h.
References cloudViewer::Grid3D< Type >::m_totalCellCount.
|
protected |
Grid data.
Definition at line 544 of file Grid3D.h.
Referenced by cloudViewer::Grid3D< Type >::clear(), cloudViewer::Grid3D< Type >::data(), cloudViewer::Grid3D< Type >::getValue(), cloudViewer::Grid3D< Type >::init(), and cloudViewer::Grid3D< Type >::setValue().
|
protected |
3D grid size without margin
Definition at line 555 of file Grid3D.h.
Referenced by cloudViewer::Grid3D< Type >::clear(), cloudViewer::Grid3D< Type >::init(), and cloudViewer::Grid3D< Type >::innerCellCount().
|
protected |
Dimensions of the grid (without margin)
Definition at line 547 of file Grid3D.h.
Referenced by cloudViewer::Grid3D< Type >::clear(), cloudViewer::Grid3D< Type >::init(), and cloudViewer::Grid3D< Type >::size().
|
protected |
Margin.
Definition at line 549 of file Grid3D.h.
Referenced by cloudViewer::Grid3D< Type >::clear(), and cloudViewer::Grid3D< Type >::init().
|
protected |
First index of real data (i.e. after marin)
Definition at line 559 of file Grid3D.h.
Referenced by cloudViewer::Grid3D< Type >::clear(), cloudViewer::Grid3D< Type >::init(), and cloudViewer::Grid3D< Type >::pos2index().
|
protected |
1D row size (with margin)
Definition at line 551 of file Grid3D.h.
Referenced by cloudViewer::Grid3D< Type >::clear(), cloudViewer::Grid3D< Type >::init(), and cloudViewer::Grid3D< Type >::pos2index().
|
protected |
2D slice size (with margin)
Definition at line 553 of file Grid3D.h.
Referenced by cloudViewer::Grid3D< Type >::clear(), cloudViewer::Grid3D< Type >::init(), and cloudViewer::Grid3D< Type >::pos2index().
|
protected |
3D grid size with margin
Definition at line 557 of file Grid3D.h.
Referenced by cloudViewer::Grid3D< Type >::clear(), cloudViewer::Grid3D< Type >::init(), cloudViewer::Grid3D< Type >::isInitialized(), and cloudViewer::Grid3D< Type >::totalCellCount().