ChunkManager.hpp
Go to the documentation of this file.
1 
37 #ifndef CHUNK_MANAGER_HPP
38 #define CHUNK_MANAGER_HPP
39 
44 #include "lvr2/io/Model.hpp"
45 #include "lvr2/types/Channel.hpp"
46 
47 namespace lvr2
48 {
49 
51 {
52  public:
53  using FilterFunction = std::function<bool(MultiChannelMap::val_type, size_t)>;
54 
69  float chunksize,
70  float maxChunkOverlap,
71  std::string savePath,
72  std::string layer = std::string("mesh"),
73  size_t cacheSize = 200
74  );
75 
76 
77  ChunkManager(std::vector<MeshBufferPtr> meshes,
78  float chunksize,
79  float maxChunkOverlap,
80  std::string savePath,
81  std::vector<std::string> layers,
82  size_t cacheSize = 200);
83 
94  ChunkManager(std::string hdf5Path, size_t cacheSize = 200, float chunkSize = 10.0f);
95 
102  {
103  return m_boundingBox;
104  }
105 
116  void buildChunks(MeshBufferPtr mesh, float maxChunkOverlap, std::string savePath, std::string layer = std::string("mesh"));
117 
127  MeshBufferPtr extractArea(const BoundingBox<BaseVector<float>>& area, std::string layer= std::string("mesh"));
128 
129  void extractArea(const BoundingBox<BaseVector<float> >& area,
130  std::unordered_map<std::size_t, MeshBufferPtr>& chunks,
131  std::string layer = std::string("mesh"));
132 
133 
156  const std::map<std::string, FilterFunction> filter,
157  std::string layer = std::string("mesh"));
158 
164  std::vector<std::string> getChannelsFromMesh(std::string layer = std::string("mesh"));
165 
170  void loadAllChunks(std::string layer = std::string("mesh"));
171 
172  private:
181 
196  void
197  cutLargeFaces(std::shared_ptr<HalfEdgeMesh<BaseVector<float>>> halfEdgeMesh,
198  float overlapRatio,
199  std::shared_ptr<std::unordered_map<unsigned int, unsigned int>> splitVertices,
200  std::shared_ptr<std::unordered_map<unsigned int, unsigned int>> splitFaces);
201 
211  const FaceHandle& handle) const;
212 
213  // /**
214  // * @brief find corresponding grid cell of given point
215  // *
216  // * @param vec point of mesh to find cell id for
217  // * @return cell id
218  // */
219  // std::string getCellName(const BaseVector<float>& vec) const;
220 
228 
239  template <typename T>
241  std::unordered_map<std::size_t, MeshBufferPtr>& chunks,
242  std::string channelName,
243  std::size_t staticVertexIndexOffset,
244  std::size_t numVertices,
245  std::size_t numFaces,
246  std::vector<std::unordered_map<std::size_t, std::size_t>>& areaVertexIndices);
247 
261  template <typename T>
263  applyChannelFilter(const std::vector<bool>& vertexFilter,
264  const std::vector<bool>& faceFilter,
265  const size_t numVertices,
266  const size_t numFaces,
267  const MeshBufferPtr meshBuffer,
268  const MultiChannelMap::val_type& originalChannel) const;
269 };
270 
271 } /* namespace lvr2 */
272 
273 #include "ChunkManager.tcc"
274 
275 #endif // CHUNK_MANAGER_HPP
BaseVector.hpp
lvr2::BaseVector< float >
ChunkHashGrid.hpp
lvr2::FaceHandle
Handle to access faces of the mesh.
Definition: Handles.hpp:140
lvr2::ChunkManager::extractChannelOfArea
ChannelPtr< T > extractChannelOfArea(std::unordered_map< std::size_t, MeshBufferPtr > &chunks, std::string channelName, std::size_t staticVertexIndexOffset, std::size_t numVertices, std::size_t numFaces, std::vector< std::unordered_map< std::size_t, std::size_t >> &areaVertexIndices)
reads and combines a channel of multiple chunks
lvr2::ChunkManager::applyChannelFilter
MultiChannelMap::val_type applyChannelFilter(const std::vector< bool > &vertexFilter, const std::vector< bool > &faceFilter, const size_t numVertices, const size_t numFaces, const MeshBufferPtr meshBuffer, const MultiChannelMap::val_type &originalChannel) const
applies given filter arrays to one channel
lvr2::ChunkHashGrid
Definition: ChunkHashGrid.hpp:67
lvr2::ChunkManager::getChannelsFromMesh
std::vector< std::string > getChannelsFromMesh(std::string layer=std::string("mesh"))
Get all existing channels from mesh.
Definition: ChunkManager.cpp:115
Channel.hpp
lvr2::ChunkHashGrid::m_boundingBox
BoundingBox< BaseVector< float > > m_boundingBox
Definition: ChunkHashGrid.hpp:276
lvr2::ChunkManager::buildChunks
void buildChunks(MeshBufferPtr mesh, float maxChunkOverlap, std::string savePath, std::string layer=std::string("mesh"))
buildChunks builds chunks from an original mesh
Definition: ChunkManager.cpp:652
lvr2::ChunkManager::getFaceCenter
BaseVector< float > getFaceCenter(std::shared_ptr< HalfEdgeMesh< BaseVector< float >>> mesh, const FaceHandle &handle) const
getFaceCenter gets the center point for a given face
Definition: ChunkManager.cpp:735
lvr2::ChunkManager::initBoundingBox
void initBoundingBox(MeshBufferPtr mesh)
initBoundingBox calculates a bounding box of the original mesh
Definition: ChunkManager.cpp:525
lvr2::ChunkManager::loadAllChunks
void loadAllChunks(std::string layer=std::string("mesh"))
Loads all chunks into the ChunkHashGrid. DEBUG – Only used for testing, but might be useful for small...
Definition: ChunkManager.cpp:759
lvr2::ChannelPtr
typename Channel< T >::Ptr ChannelPtr
Definition: Channel.hpp:82
Model.hpp
filter
void filter(lvr2::PointBufferPtr &cloud, lvr2::indexArray &inlier, size_t j)
Definition: src/tools/lvr2_cl_sor/Main.cpp:40
lvr2::BoundingBox
A dynamic bounding box class.
Definition: BoundingBox.hpp:49
lvr2::ChunkManager::getGlobalBoundingBox
BoundingBox< BaseVector< float > > getGlobalBoundingBox()
getGlobalBoundingBox is a getter for the bounding box of the entire chunked model
Definition: ChunkManager.hpp:101
lvr2::ChunkManager::ChunkManager
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.
Definition: ChunkManager.cpp:66
lvr2::ChunkManager::FilterFunction
std::function< bool(MultiChannelMap::val_type, size_t)> FilterFunction
Definition: ChunkManager.hpp:53
lvr2::ChunkManager::extractArea
MeshBufferPtr extractArea(const BoundingBox< BaseVector< float >> &area, std::string layer=std::string("mesh"))
extractArea creates and returns MeshBufferPtr of merged chunks for given area.
Definition: ChunkManager.cpp:201
lvr2
Definition: BaseBufferManipulators.hpp:39
lvr2::VariantChannel
Definition: VariantChannel.hpp:18
lvr2::ChunkManager::getCellCoordinates
BaseVector< int > getCellCoordinates(const BaseVector< float > &vec) const
returns the grid coordinates of a given point
Definition: ChunkManager.cpp:743
lvr2::MeshBufferPtr
std::shared_ptr< MeshBuffer > MeshBufferPtr
Definition: MeshBuffer.hpp:217
lvr2::ChunkManager::cutLargeFaces
void cutLargeFaces(std::shared_ptr< HalfEdgeMesh< BaseVector< float >>> halfEdgeMesh, float overlapRatio, std::shared_ptr< std::unordered_map< unsigned int, unsigned int >> splitVertices, std::shared_ptr< std::unordered_map< unsigned int, unsigned int >> splitFaces)
cutLargeFaces cuts a face if it is too large
Definition: ChunkManager.cpp:536
mesh
HalfEdgeMesh< Vec > mesh
Definition: src/tools/lvr2_gs_reconstruction/Main.cpp:26
lvr2::ChunkManager
Definition: ChunkManager.hpp:50
BoundingBox.hpp
ChunkBuilder.hpp
lvr2::HalfEdgeMesh
Half-edge data structure implementing the BaseMesh interface.
Definition: HalfEdgeMesh.hpp:70


lvr2
Author(s): Thomas Wiemann , Sebastian Pütz , Alexander Mock , Lars Kiesow , Lukas Kalbertodt , Tristan Igelbrink , Johan M. von Behren , Dominik Feldschnieders , Alexander Löhr
autogenerated on Wed Mar 2 2022 00:37:23