MeshLib
 
Loading...
Searching...
No Matches
MRVoxelsConversionsByParts.h
Go to the documentation of this file.
1#pragma once
2#include "MRMeshFwd.h"
3#ifndef MRMESH_NO_OPENVDB
4#include "MRExpected.h"
5#include "MRPartMapping.h"
6
7namespace MR
8{
9
17struct MergeVolumePartSettings
18{
20 using PreCutCallback = std::function<void( Mesh& mesh, float leftCutPosition, float rightCutPosition )>;
23 using PostCutCallback = std::function<void( Mesh& )>;
28 using PostMergeCallback = std::function<void( Mesh&, const PartMapping& )>;
34};
35
57template <typename Volume>
59mergeVolumePart( Mesh& mesh, std::vector<EdgePath>& cutContours, Volume&& volume, float leftCutPosition, float rightCutPosition,
60 const MergeVolumePartSettings& settings = {} );
61
64template <typename Volume>
65using VolumePartBuilder = std::function<Expected<Volume> ( int begin, int end, std::optional<Vector3i>& offset )>;
66
75{
77 size_t maxVolumePartMemoryUsage = 2 << 28; // 256 MiB
79 size_t stripeOverlap = 4;
80};
81
94template <typename Volume>
96volumeToMeshByParts( const VolumePartBuilder<Volume>& builder, const Vector3i& dimensions, const Vector3f& voxelSize,
97 const VolumeToMeshByPartsSettings& settings = {}, const MergeVolumePartSettings& mergeSettings = {} );
98
99}
100#endif
represents a 3-dimentional float-typed vector
Definition MRDotNet/MRVector3.h:8
auto begin(const BitSet &a)
Definition MRMesh/MRBitSet.h:263
auto end(const BitSet &)
Definition MRMesh/MRBitSet.h:265
Definition MRCameraOrientationPlugin.h:7
tl::expected< T, E > Expected
Definition MRExpected.h:49
std::function< Expected< Volume >(int begin, int end, std::optional< Vector3i > &offset)> VolumePartBuilder
Definition MRVoxelsConversionsByParts.h:65
Expected< Mesh > volumeToMeshByParts(const VolumePartBuilder< Volume > &builder, const Vector3i &dimensions, const Vector3f &voxelSize, const VolumeToMeshByPartsSettings &settings={}, const MergeVolumePartSettings &mergeSettings={})
converts a voxel volume into a mesh without full memory loading
VoidOrErrStr mergeVolumePart(Mesh &mesh, std::vector< EdgePath > &cutContours, Volume &&volume, float leftCutPosition, float rightCutPosition, const MergeVolumePartSettings &settings={})
Merge one mesh with another generated from a voxel volume part.
Expected< void > VoidOrErrStr
return type for a void function that can produce an error string
Definition MRExpected.h:60
Parameters' structure for MR::mergeVolumePart.
PartMapping mapping
mapping with initialized maps required for the postMerge callback
Definition MRVoxelsConversionsByParts.h:31
PostCutCallback postCut
Definition MRVoxelsConversionsByParts.h:24
Vector3f origin
origin (position of the (0;0;0) voxel) of the voxel volume part, usually specified for SimpleVolume
Definition MRVoxelsConversionsByParts.h:33
std::function< void(Mesh &, const PartMapping &)> PostMergeCallback
Definition MRVoxelsConversionsByParts.h:28
PreCutCallback preCut
Definition MRVoxelsConversionsByParts.h:21
std::function< void(Mesh &mesh, float leftCutPosition, float rightCutPosition)> PreCutCallback
callback to process the generated mesh before the side cutting, e.g. fixing specific generation artif...
Definition MRVoxelsConversionsByParts.h:20
std::function< void(Mesh &)> PostCutCallback
callback to process the generated mesh after the side cutting, e.g. decimating
Definition MRVoxelsConversionsByParts.h:23
PostMergeCallback postMerge
Definition MRVoxelsConversionsByParts.h:29
Definition MRMesh/MRMesh.h:23
Definition MRPartMapping.h:10
Parameters' structure for MR::volumeToMeshByParts.
size_t stripeOverlap
overlap in voxels between two parts
Definition MRVoxelsConversionsByParts.h:79
size_t maxVolumePartMemoryUsage
the upper limit of memory amount used to store a voxel volume part
Definition MRVoxelsConversionsByParts.h:77