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