Template Class HashGrid
Defined in File HashGrid.hpp
Inheritance Relationships
Base Type
public lvr2::GridBase(Class GridBase)
Derived Type
public lvr2::PointsetGrid< BaseVecT, BoxT >(Template Class PointsetGrid)
Class Documentation
-
template<typename BaseVecT, typename BoxT>
class HashGrid : public lvr2::GridBase Subclassed by lvr2::PointsetGrid< BaseVecT, BoxT >
Public Types
-
typedef std::vector<QueryPoint<BaseVecT>*> qp_list
type alias for list of query points
Public Functions
-
HashGrid(float resolution, BoundingBox<BaseVecT> bb, bool isVoxelsize = true, bool extrude = true)
Construct an empty HashGrid object.
- Parameters:
resolution – if isVoxelsize: voxel size. if not: number of voxels on the longest size of bb.
bb – the bounding box of the grid
isVoxelsize – see resolution description
extrude – add cells around the existing ones
-
inline HashGrid(std::string file, const BoundingBox<BaseVecT> &boundingBox, float voxelsize)
Construct a new Hash Grid object from a file.
- Parameters:
file – A file written by saveGrid(file).
boundingBox – Bounding box of the grid.
voxelsize – The voxel size of the grid.
-
inline HashGrid(const std::vector<std::string> &files, const BoundingBox<BaseVecT> &boundingBox, float voxelsize)
Construct a new Hash Grid object from multiple files.
- Parameters:
files – A list of files each written by saveGrid(file).
boundingBox – Bounding box of the grid.
voxelsize – The voxel size of the grid.
-
HashGrid(const std::vector<string> &files, const std::vector<BoundingBox<BaseVecT>> &innerBoxes, const BoundingBox<BaseVecT> &boundingBox, float voxelsize)
Construct a new Hash Grid object from multiple files.
- Parameters:
files – A list of files each written by saveGrid(file).
innerBoxes – A list of bounding boxes for each file. Useful for removing overlap.
boundingBox – Bounding box of the grid.
voxelsize – The voxel size of the grid.
-
inline HashGrid(PointBufferPtr src, const BoundingBox<BaseVecT> &boundingBox, float voxelsize)
Construct a new Hash Grid object from a PointBuffer.
- Parameters:
src – A PointBuffer created with toPointBuffer().
boundingBox – Bounding box of the grid.
voxelsize – The voxel size of the grid.
-
HashGrid(const std::vector<PointBufferPtr> &chunks, const std::vector<BoundingBox<BaseVecT>> &innerBoxes, const BoundingBox<BaseVecT> &boundingBox, float voxelsize)
Construct a new Hash Grid object from multiple PointBuffers.
- Parameters:
chunks – A list of PointBuffers each created with toPointBuffer().
innerBoxes – A list of bounding boxes for each buffer. Useful for removing overlap.
boundingBox – Bounding box of the grid.
voxelsize – The voxel size of the grid.
-
PointBufferPtr toPointBuffer() const
Create a PointBuffer containing the cells and distances.
Can be converted back to a HashGrid with HashGrid(PointBufferPtr, …).
-
virtual void addLatticePoint(int i, int j, int k, float distance = 0.0) override
Add one cell to the grid. When adding multiple cells, use addLatticePoints()
Note that distances are measured at the Corners of a cell, and the distance parameter is only used to fill remaining corners that aren’t shared with existing cells.
- Parameters:
i – Discrete x position within the grid.
j – Discrete y position within the grid.
k – Discrete z position within the grid.
distance – Signed distance to the represented surface at the position within the grid.
-
void addLatticePoints(const std::unordered_set<Vector3i> &indices)
Add many lattice points at once.
- Parameters:
indices – the {i,j,k} indices of the lattice points
-
virtual void saveGrid(std::string file) override
Saves a representation of the grid to the given file.
- Parameters:
file – Output file name.
-
inline size_t getNumberOfCells() const
-
inline box_map_it firstCell()
- Returns:
Returns an iterator to the first box in the cell map.
-
inline box_map_it lastCell()
- Returns:
Returns an iterator to the last box in the cell map.
-
inline query_point_it firstQueryPoint()
- Returns:
Returns an iterator to the first query point
-
inline query_point_it lastQueryPoint()
-
inline std::vector<QueryPoint<BaseVecT>> &getQueryPoints()
-
inline const std::vector<QueryPoint<BaseVecT>> &getQueryPoints() const
-
virtual ~HashGrid()
-
inline void setBB(BoundingBox<BaseVecT> &bb)
-
inline BoundingBox<BaseVecT> &getBoundingBox()
-
inline const BoundingBox<BaseVecT> &getBoundingBox() const
Protected Functions
-
void fillNeighbors()
Fill in the neighbors of all cells.
Protected Attributes
-
float m_voxelsize
The voxelsize used for reconstruction.
-
std::vector<QueryPoint<BaseVecT>> m_queryPoints
A vector containing the query points for the reconstruction.
-
BoundingBox<BaseVecT> m_boundingBox
Bounding box of the covered volume.
-
typedef std::vector<QueryPoint<BaseVecT>*> qp_list