MeshLib Documentation
Loading...
Searching...
No Matches
MRMesh/MRBooleanOperation.h
Go to the documentation of this file.
1#pragma once
2
3#include "MRVector.h"
4#include "MRExpected.h"
5#include "MRId.h"
6#include <array>
7
8namespace MR
9{
10
13
20{
23 InsideA,
26 InsideB,
35 Union,
45
46 Count
47};
48
56struct BooleanResultMapper
57{
59 enum class MapObject { A, B, Count };
60
62
64 MRMESH_API FaceBitSet map( const FaceBitSet& oldBS, MapObject obj ) const;
66 MRMESH_API VertBitSet map( const VertBitSet& oldBS, MapObject obj ) const;
68 MRMESH_API EdgeBitSet map( const EdgeBitSet& oldBS, MapObject obj ) const;
70 MRMESH_API FaceBitSet newFaces() const;
71
73 MRMESH_API FaceBitSet filteredOldFaceBitSet( const FaceBitSet& oldBS, MapObject obj );
74
75 struct Maps
76 {
79 FaceMap cut2origin;
81 FaceMap cut2newFaces;
83 WholeEdgeMap old2newEdges;
85 VertMap old2newVerts;
87 bool identity{false};
88 };
89 std::array<Maps, size_t( MapObject::Count )> maps;
90
91 [[nodiscard]] const Maps& getMaps( MapObject index ) const { return maps[ int( index ) ]; }
92};
93
96{
98 const Mesh* originalMeshA{ nullptr };
100 const Mesh* originalMeshB{ nullptr };
102 std::vector<EdgeLoop>* optionalOutCut{ nullptr };
103};
104
109 const std::vector<EdgePath>& cutEdgesA, const std::vector<EdgePath>& cutEdgesB,
110 BooleanOperation operation, const AffineXf3f* rigidB2A = nullptr,
111 BooleanResultMapper* mapper = nullptr,
112 bool mergeAllNonIntersectingComponents = false,
113 const BooleanInternalParameters& intParams = {} );
114
116
117} //namespace MR
#define MRMESH_API
Definition MRMesh/MRMeshFwd.h:46
MRMESH_API Expected< Mesh > doBooleanOperation(Mesh &&meshACut, Mesh &&meshBCut, const std::vector< EdgePath > &cutEdgesA, const std::vector< EdgePath > &cutEdgesB, BooleanOperation operation, const AffineXf3f *rigidB2A=nullptr, BooleanResultMapper *mapper=nullptr, bool mergeAllNonIntersectingComponents=false, const BooleanInternalParameters &intParams={})
BooleanOperation
Definition MRMesh/MRBooleanOperation.h:20
Definition MRCameraOrientationPlugin.h:8
tl::expected< T, E > Expected
Definition MRExpected.h:58
Parameters will be useful if specified.
Definition MRMesh/MRBooleanOperation.h:96
const Mesh * originalMeshA
Instance of original mesh with tree for better speed.
Definition MRMesh/MRBooleanOperation.h:98
std::vector< EdgeLoop > * optionalOutCut
Optional output cut edges of booleaned meshes.
Definition MRMesh/MRBooleanOperation.h:102
const Mesh * originalMeshB
Instance of original mesh with tree for better speed.
Definition MRMesh/MRBooleanOperation.h:100
Definition MRMesh/MRBooleanOperation.h:76
WholeEdgeMap old2newEdges
"origin" edges to "after stitch" edges (1-1)
Definition MRMesh/MRBooleanOperation.h:83
FaceMap cut2newFaces
"after cut" faces to "after stitch" faces (1-1)
Definition MRMesh/MRBooleanOperation.h:81
FaceMap cut2origin
Definition MRMesh/MRBooleanOperation.h:79
bool identity
old topology indexes are valid if true
Definition MRMesh/MRBooleanOperation.h:87
VertMap old2newVerts
"origin" vertices to "after stitch" vertices (1-1)
Definition MRMesh/MRBooleanOperation.h:85
Structure to map old mesh BitSets to new.
std::array< Maps, size_t(MapObject::Count)> maps
Definition MRMesh/MRBooleanOperation.h:89
MRMESH_API FaceBitSet map(const FaceBitSet &oldBS, MapObject obj) const
Returns faces bitset of result mesh corresponding input one.
const Maps & getMaps(MapObject index) const
Definition MRMesh/MRBooleanOperation.h:91
MRMESH_API FaceBitSet newFaces() const
Returns only new faces that are created during boolean operation.
MRMESH_API FaceBitSet filteredOldFaceBitSet(const FaceBitSet &oldBS, MapObject obj)
returns updated oldBS leaving only faces that has corresponding ones in result mesh
MRMESH_API EdgeBitSet map(const EdgeBitSet &oldBS, MapObject obj) const
Returns edges bitset of result mesh corresponding input one.
MRMESH_API VertBitSet map(const VertBitSet &oldBS, MapObject obj) const
Returns vertices bitset of result mesh corresponding input one.
MapObject
Input object index enum.
Definition MRMesh/MRBooleanOperation.h:59
Definition MRMesh/MRMesh.h:23