MeshLib
 
Loading...
Searching...
No Matches
MRMeshTrimWithPlane.h
Go to the documentation of this file.
1#pragma once
2
3#include "MRMeshFwd.h"
4#include "MRPlane3.h"
5#include <functional>
6namespace MR
7{
8
14MRMESH_API FaceBitSet subdivideWithPlane( Mesh & mesh, const Plane3f & plane, FaceHashMap * new2Old = nullptr, float eps = 0, std::function<void(EdgeId, EdgeId, float )> onEdgeSplitCallback = nullptr );
15
26[[deprecated]] MRMESH_API void trimWithPlane( Mesh& mesh, const Plane3f & plane,
27 UndirectedEdgeBitSet * outCutEdges = nullptr, FaceHashMap * new2Old = nullptr, float eps = 0, std::function<void( EdgeId, EdgeId, float )> onEdgeSplitCallback = nullptr );
28
39[[deprecated]] MRMESH_API void trimWithPlane( Mesh& mesh, const Plane3f & plane,
40 std::vector<EdgeLoop> * outCutContours, FaceHashMap * new2Old = nullptr, float eps = 0, std::function<void( EdgeId, EdgeId, float )> onEdgeSplitCallback = nullptr );
41
42// stores basic params for trimWithPlane function
44{
45 //Input plane to cut mesh with
46 Plane3f plane;
47 // if existing vertex is within eps distance from the plane, then move the vertex not introducing new ones
48 float eps = 0;
49 // is invoked each time when an edge is split. Receives edge ID before split, edge ID after split, and weight of the origin vertex
50 std::function<void( EdgeId, EdgeId, float )> onEdgeSplitCallback;
51};
52
53// stores optional output params for trimWithPlane function
55{
56 // newly appeared hole boundary edges
57 UndirectedEdgeBitSet* outCutEdges = nullptr;
58 // newly appeared hole contours where each edge does not have right face
59 std::vector<EdgeLoop>* outCutContours = nullptr;
60 // mapping from newly appeared triangle to its original triangle (part to full)
61 FaceHashMap* new2Old = nullptr;
62 // left part of the trimmed mesh
63 Mesh* otherPart = nullptr;
64 // mapping from newly appeared triangle to its original triangle (part to full) in otherPart
66 // newly appeared hole contours where each edge does not have right face in otherPart
67 std::vector<EdgeLoop>* otherOutCutContours = nullptr;
68};
69
77MRMESH_API void trimWithPlane( Mesh& mesh, const TrimWithPlaneParams& params, const TrimOptionalOutput& optOut = {} );
78
79} //namespace MR
int EdgeId
Definition MRDotNet/MRMeshFwd.h:52
#define MRMESH_API
Definition MRMesh/MRMeshFwd.h:46
Definition MRDotNet/MRBitSet.h:39
Definition MRCameraOrientationPlugin.h:7
MRMESH_API FaceBitSet subdivideWithPlane(Mesh &mesh, const Plane3f &plane, FaceHashMap *new2Old=nullptr, float eps=0, std::function< void(EdgeId, EdgeId, float)> onEdgeSplitCallback=nullptr)
HashMap< FaceId, FaceId > FaceHashMap
Definition MRMesh/MRMeshFwd.h:454
MRMESH_API void trimWithPlane(Mesh &mesh, const Plane3f &plane, UndirectedEdgeBitSet *outCutEdges=nullptr, FaceHashMap *new2Old=nullptr, float eps=0, std::function< void(EdgeId, EdgeId, float)> onEdgeSplitCallback=nullptr)
trim mesh by plane
Definition MRMesh/MRMesh.h:23
Definition MRMeshTrimWithPlane.h:55
Mesh * otherPart
Definition MRMeshTrimWithPlane.h:63
FaceHashMap * new2Old
Definition MRMeshTrimWithPlane.h:61
std::vector< EdgeLoop > * otherOutCutContours
Definition MRMeshTrimWithPlane.h:67
UndirectedEdgeBitSet * outCutEdges
Definition MRMeshTrimWithPlane.h:57
FaceHashMap * otherNew2Old
Definition MRMeshTrimWithPlane.h:65
std::vector< EdgeLoop > * outCutContours
Definition MRMeshTrimWithPlane.h:59
Definition MRMeshTrimWithPlane.h:44
float eps
Definition MRMeshTrimWithPlane.h:48
std::function< void(EdgeId, EdgeId, float)> onEdgeSplitCallback
Definition MRMeshTrimWithPlane.h:50
Plane3f plane
Definition MRMeshTrimWithPlane.h:46