MeshLib
 
Loading...
Searching...
No Matches
MRUniteManyMeshes.h
Go to the documentation of this file.
1#pragma once
2#include "MRMeshFwd.h"
3#include "MRMesh.h"
4#include "MRExpected.h"
5#include <string>
6
7namespace MR
8{
9// Mode of processing components
11{
12 Remove, // Default: separate nested meshes and remove them, just like union operation should do, use this if input meshes are single component
13 Merge, // merge nested meshes, useful if input meshes are components of single object
14 Union // does not separate components and call union for all input meshes, works slower than Remove and Merge method but returns valid result if input meshes has multiple components
15};
16
17// Parameters structure for uniteManyMeshes function
19{
20 // Apply random shift to each mesh, to prevent degenerations on coincident surfaces
21 bool useRandomShifts{ false };
22 // Try fix degenerations after each boolean step, to prevent boolean failure due to high amount of degenerated faces
23 // useful on meshes with many coincident surfaces
24 // (useRandomShifts used for same issue)
25 bool fixDegenerations{ false };
26 // Max allowed random shifts in each direction, and max allowed deviation after degeneration fixing
27 // not used if both flags (useRandomShifts,fixDegenerations) are false
28 float maxAllowedError{ 1e-5f };
29 // Seed that is used for random shifts
30 unsigned int randomShiftsSeed{ 0 };
31 // If set, the bitset will store new faces created by boolean operations
32 FaceBitSet* newFaces{ nullptr };
33
34 // By default function separate nested meshes and remove them, just like union operation should do
35 // read comment of NestedComponenetsMode enum for more information
37
39};
40
41// Computes the surface of objects' union each of which is defined by its own surface mesh
42// - merge non intersecting meshes first
43// - unite merged groups
44MRMESH_API Expected<Mesh> uniteManyMeshes( const std::vector<const Mesh*>& meshes,
45 const UniteManyMeshesParams& params = {} );
46
47}
#define MRMESH_API
Definition MRMesh/MRMeshFwd.h:46
Definition MRDotNet/MRBitSet.h:39
std::function< bool(float)> ProgressCallback
Definition MRMesh/MRMeshFwd.h:589
Definition MRCameraOrientationPlugin.h:7
NestedComponenetsMode
Definition MRUniteManyMeshes.h:11
MRMESH_API Expected< Mesh > uniteManyMeshes(const std::vector< const Mesh * > &meshes, const UniteManyMeshesParams &params={})
tl::expected< T, E > Expected
Definition MRExpected.h:49
Definition MRUniteManyMeshes.h:19
bool fixDegenerations
Definition MRUniteManyMeshes.h:25
NestedComponenetsMode nestedComponentsMode
Definition MRUniteManyMeshes.h:36
unsigned int randomShiftsSeed
Definition MRUniteManyMeshes.h:30
float maxAllowedError
Definition MRUniteManyMeshes.h:28
ProgressCallback progressCb
Definition MRUniteManyMeshes.h:38
bool useRandomShifts
Definition MRUniteManyMeshes.h:21
FaceBitSet * newFaces
Definition MRUniteManyMeshes.h:32