Class ChunkManager

Inheritance Relationships

Base Type

Class Documentation

class ChunkManager : public lvr2::ChunkHashGrid

Public Types

using FilterFunction = std::function<bool(MultiChannelMap::val_type, size_t)>

Public Functions

ChunkManager(MeshBufferPtr meshes, float chunksize, float maxChunkOverlap, std::string savePath, std::string layer = std::string("mesh"), size_t cacheSize = 200)

ChunkManager creates chunks from an original mesh.

Chunks the original model into chunks of given size. Every created chunk has the same length in height, width and depth.

Parameters:
  • mesh – mesh to be chunked

  • chunksize – size of a chunk - unit depends on the given mesh

  • maxChunkOverlap – maximum allowed overlap between chunks relative to the chunk size. Larger triangles will be cut

  • savePath – JUST FOR TESTING - REMOVE LATER ON

  • cacheSize – maximum number of chunks loaded in the ChunkHashGrid

ChunkManager(std::vector<MeshBufferPtr> meshes, float chunksize, float maxChunkOverlap, std::string savePath, std::vector<std::string> layers, size_t cacheSize = 200)
ChunkManager(std::string hdf5Path, size_t cacheSize = 200, float chunkSize = 10.0f)

ChunkManager loads a ChunkManager from a given HDF5-file.

Creates a ChunkManager from an already chunked HDF5 file and allows loading individual chunks and combining them to partial meshes. Every loaded chunk has the same length in height, width and depth.

Parameters:
  • hdf5Path – path to the HDF5 file, where chunks and additional information are stored

  • cacheSize – maximum number of chunks loaded in the ChunkHashGrid

inline BoundingBox<BaseVector<float>> getGlobalBoundingBox()

getGlobalBoundingBox is a getter for the bounding box of the entire chunked model

Returns:

global bounding box of chunked model

void buildChunks(MeshBufferPtr mesh, float maxChunkOverlap, std::string savePath, std::string layer = std::string("mesh"))

buildChunks builds chunks from an original mesh

Creates chunks from an original mesh and initializes the initial chunk structure

Parameters:
  • mesh – mesh which is being chunked

  • maxChunkOverlap – maximum allowed overlap between chunks relative to the chunk size. Larger triangles will be cut

  • savePath – UST FOR TESTING - REMOVE LATER ON

MeshBufferPtr extractArea(const BoundingBox<BaseVector<float>> &area, std::string layer = std::string("mesh"))

extractArea creates and returns MeshBufferPtr of merged chunks for given area.

Finds corresponding chunks for given area inside the grid and merges those chunks to a new mesh without duplicated vertices. The new mesh is returned as MeshBufferPtr.

Parameters:

area

Returns:

mesh of the given area

void extractArea(const BoundingBox<BaseVector<float>> &area, std::unordered_map<std::size_t, MeshBufferPtr> &chunks, std::string layer = std::string("mesh"))
MeshBufferPtr extractArea(const BoundingBox<BaseVector<float>> &area, const std::map<std::string, FilterFunction> filter, std::string layer = std::string("mesh"))

extractArea creates and returns MeshBufferPtr of merged chunks for given area after filtering the resulting mesh.

Finds corresponding chunks for given area inside the grid and merges those chunks to a new mesh without duplicated vertices. The new mesh is returned as MeshBufferPtr. After extracting the area, given filters are being applied to allow more precise quaries for use cases like robot navigation while minimizing network traffic.

example for a filter: std::map<std::string, lvr2::ChunkManager::FilterFunction> filter = {{“roughness”, [](lvr2::MultiChannelMap::val_type channel, size_t index) { return channel.dataPtr<float>()[index] < 0.1; }}}; This filter will only use vertices that have a maximum roughness of 0,1. All Faces referencing the filtered vertices will be filtered too.

Parameters:
  • area – bounding box of the area to request

  • filter – map of filters with channel names as keys and functions as values

Returns:

mesh of the given area

std::vector<std::string> getChannelsFromMesh(std::string layer = std::string("mesh"))

Get all existing channels from mesh.

Returns:

List of all channel names as vector

void loadAllChunks(std::string layer = std::string("mesh"))

Loads all chunks into the ChunkHashGrid. DEBUG &#8212; Only used for testing, but might be useful for smaller meshes.