MeshLib Documentation
Loading...
Searching...
No Matches
MRMesh/MRMeshBoolean.h
Go to the documentation of this file.
1#pragma once
2
4#include "MRContoursCut.h"
5#include "MRMesh.h"
6#include "MRBitSet.h"
7#include "MRExpected.h"
8#include <string>
9
10namespace MR
11{
12
26struct BooleanResult
27{
35 std::string errorString;
37 bool valid() const { return errorString.empty(); }
38 Mesh& operator*() { return mesh; }
39 const Mesh& operator*() const { return mesh; }
40 Mesh* operator->() { return &mesh; }
41 const Mesh* operator->() const { return &mesh; }
42 operator bool()const { return valid(); }
43};
44
58MRMESH_API BooleanResult boolean( const Mesh& meshA, const Mesh& meshB, BooleanOperation operation,
59 const AffineXf3f* rigidB2A, BooleanResultMapper* mapper = nullptr, ProgressCallback cb = {} );
61 const AffineXf3f* rigidB2A, BooleanResultMapper* mapper = nullptr, ProgressCallback cb = {} );
62
63
69
75{
77 const AffineXf3f* rigidB2A = nullptr;
85 std::vector<EdgeLoop>* outCutEdges = nullptr;
90};
91
92MRMESH_API BooleanResult boolean( const Mesh& meshA, const Mesh& meshB, BooleanOperation operation,
93 const BooleanParameters& params = {} );
95 const BooleanParameters& params = {} );
96
99{
100 VertBitSet meshAVerts;
101 VertBitSet meshBVerts;
102 std::vector<Vector3f> intersectionPoints;
103};
104
116 const AffineXf3f* rigidB2A = nullptr );
117
118} //namespace MR
#define MRMESH_API
Definition MRMesh/MRMeshFwd.h:46
std::function< bool(float)> ProgressCallback
Definition MRMesh/MRMeshFwd.h:576
MRMESH_API BooleanResult boolean(const Mesh &meshA, const Mesh &meshB, BooleanOperation operation, const AffineXf3f *rigidB2A, BooleanResultMapper *mapper=nullptr, ProgressCallback cb={})
Performs CSG operation on two meshes.
BooleanOperation
Definition MRMesh/MRBooleanOperation.h:20
std::vector< OneMeshContour > OneMeshContours
Special data type for MR::cutMesh.
Definition MRMesh/MRContoursCut.h:48
MRMESH_API Expected< BooleanResultPoints, std::string > getBooleanPoints(const Mesh &meshA, const Mesh &meshB, BooleanOperation operation, const AffineXf3f *rigidB2A=nullptr)
Returns the points of mesh boolean's result mesh.
Definition MRCameraOrientationPlugin.h:8
tl::expected< T, E > Expected
Definition MRExpected.h:58
Definition MRMesh/MRMeshBoolean.h:75
BooleanPreCutResult * outPreCutB
Optional precut output of meshB, if present - does not perform boolean and just return them.
Definition MRMesh/MRMeshBoolean.h:83
ProgressCallback cb
Definition MRMesh/MRMeshBoolean.h:89
bool mergeAllNonIntersectingComponents
Definition MRMesh/MRMeshBoolean.h:88
std::vector< EdgeLoop > * outCutEdges
Optional output cut edges of booleaned meshes.
Definition MRMesh/MRMeshBoolean.h:85
const AffineXf3f * rigidB2A
Transform from mesh B space to mesh A space.
Definition MRMesh/MRMeshBoolean.h:77
BooleanResultMapper * mapper
Optional output structure to map mesh A and mesh B topology to result mesh topology.
Definition MRMesh/MRMeshBoolean.h:79
BooleanPreCutResult * outPreCutA
Optional precut output of meshA, if present - does not perform boolean and just return them.
Definition MRMesh/MRMeshBoolean.h:81
Definition MRMesh/MRMeshBoolean.h:65
Mesh mesh
Definition MRMesh/MRMeshBoolean.h:66
OneMeshContours contours
Definition MRMesh/MRMeshBoolean.h:67
Structure to map old mesh BitSets to new.
vertices and points representing mesh intersection result
Definition MRMesh/MRMeshBoolean.h:99
VertBitSet meshBVerts
Definition MRMesh/MRMeshBoolean.h:101
VertBitSet meshAVerts
Definition MRMesh/MRMeshBoolean.h:100
std::vector< Vector3f > intersectionPoints
Definition MRMesh/MRMeshBoolean.h:102
Structure contain boolean result.
Mesh mesh
Result mesh of boolean operation, if error occurred it would be empty.
Definition MRMesh/MRMeshBoolean.h:29
bool valid() const
Returns true if boolean succeed, false otherwise.
Definition MRMesh/MRMeshBoolean.h:37
FaceBitSet meshBBadContourFaces
If input contours have intersections, this face bit set presents faces of mesh B on which contours in...
Definition MRMesh/MRMeshBoolean.h:33
std::string errorString
Holds error message, empty if boolean succeed.
Definition MRMesh/MRMeshBoolean.h:35
FaceBitSet meshABadContourFaces
If input contours have intersections, this face bit set presents faces of mesh A on which contours in...
Definition MRMesh/MRMeshBoolean.h:31
Mesh * operator->()
Definition MRMesh/MRMeshBoolean.h:40
Mesh & operator*()
Definition MRMesh/MRMeshBoolean.h:38
const Mesh & operator*() const
Definition MRMesh/MRMeshBoolean.h:39
const Mesh * operator->() const
Definition MRMesh/MRMeshBoolean.h:41
Definition MRMesh/MRMesh.h:23