Chapter about Constructive Solid Geometry operations. More...
Classes | |
struct | MR::BooleanResultMapper |
Structure to map old mesh BitSets to new. More... | |
struct | MR::BooleanInternalParameters |
Parameters will be useful if specified. More... | |
struct | MR::CutMeshParameters |
Parameters of MR::cutMesh. More... | |
struct | MR::CutMeshResult |
struct | MR::BooleanResult |
Structure contain boolean result. More... | |
Typedefs | |
using | MR::OneMeshContours = std::vector<OneMeshContour> |
Special data type for MR::cutMesh. | |
Functions | |
MRMESH_API Expected< Mesh > | MR::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={}) |
MRMESH_API Expected< OneMeshContour, PathError > | MR::convertMeshTriPointsToMeshContour (const Mesh &mesh, const std::vector< MeshTriPoint > &meshTriPoints, SearchPathSettings searchSettings={}, std::vector< int > *pivotIndices=nullptr) |
Makes continuous contour by mesh tri points, if first and last meshTriPoint is the same, makes closed contour. | |
MRMESH_API Expected< OneMeshContour, PathError > | MR::convertMeshTriPointsToClosedContour (const Mesh &mesh, const std::vector< MeshTriPoint > &meshTriPoints, SearchPathSettings searchSettings={}, std::vector< int > *pivotIndices=nullptr) |
Makes closed continuous contour by mesh tri points, note that first and last meshTriPoint should not be same. | |
MRMESH_API OneMeshContour | MR::convertSurfacePathWithEndsToMeshContour (const Mesh &mesh, const MeshTriPoint &start, const SurfacePath &surfacePath, const MeshTriPoint &end) |
Converts SurfacePath to OneMeshContours. | |
MRMESH_API OneMeshContours | MR::convertSurfacePathsToMeshContours (const Mesh &mesh, const std::vector< SurfacePath > &surfacePaths) |
Converts SurfacePaths to OneMeshContours. | |
MRMESH_API CutMeshResult | MR::cutMesh (Mesh &mesh, const OneMeshContours &contours, const CutMeshParameters ¶ms={}) |
Cuts mesh by given contours. | |
MRMESH_API std::vector< EdgePath > | MR::cutMeshWithPlane (Mesh &mesh, const Plane3f &plane, FaceMap *mapNew2Old=nullptr) |
Simple cut mesh by plane. | |
MRMESH_API BooleanResult | MR::boolean (const Mesh &meshA, const Mesh &meshB, BooleanOperation operation, const AffineXf3f *rigidB2A, BooleanResultMapper *mapper=nullptr, ProgressCallback cb={}) |
Performs CSG operation on two meshes. | |
MRMESH_API Expected< BooleanResultPoints, std::string > | MR::getBooleanPoints (const Mesh &meshA, const Mesh &meshB, BooleanOperation operation, const AffineXf3f *rigidB2A=nullptr) |
Returns the points of mesh boolean's result mesh. | |
Chapter about Constructive Solid Geometry operations.
This chapter represents documentation of MeshLib CSG
typedef std::vector< OneMeshContour > MR::OneMeshContours = std::vector<OneMeshContour> |
Special data type for MR::cutMesh.
This is special data for MR::cutMesh, you can convert some other contours representation to it by:
MR::convertMeshTriPointsToClosedContour MR::convertSurfacePathsToMeshContours
|
strong |
Enum class of available CSG operations
MRMESH_API BooleanResult MR::boolean | ( | const Mesh & | meshA, |
const Mesh & | meshB, | ||
BooleanOperation | operation, | ||
const AffineXf3f * | rigidB2A, | ||
BooleanResultMapper * | mapper = nullptr, | ||
ProgressCallback | cb = {} ) |
Performs CSG operation on two meshes.
Makes new mesh - result of boolean operation on mesh A
and mesh B
meshA | Input mesh A |
meshB | Input mesh B |
operation | CSG operation to perform |
rigidB2A | Transform from mesh B space to mesh A space |
mapper | Optional output structure to map mesh A and mesh B topology to result mesh topology |
|
nodiscard |
Makes closed continuous contour by mesh tri points, note that first and last meshTriPoint should not be same.
Finds shortest paths between neighbor meshTriPoints
and build closed contour MR::cutMesh input
pivotIndices | optional output indices of given meshTriPoints in result OneMeshContour |
|
nodiscard |
Makes continuous contour by mesh tri points, if first and last meshTriPoint is the same, makes closed contour.
Finds shortest paths between neighbor meshTriPoints
and build contour MR::cutMesh input
searchSettings | settings for search geo path |
pivotIndices | optional output indices of given meshTriPoints in result OneMeshContour |
|
nodiscard |
Converts SurfacePaths to OneMeshContours.
Creates MR::OneMeshContours object from given surface paths for MR::cutMesh input
|
nodiscard |
Converts SurfacePath to OneMeshContours.
Creates MR::OneMeshContour object from given surface path with ends for MR::cutMesh input start
and surfacePath.front() should be from same face surfacePath.back() and end
should be from same face
note that whole path (including start
and end
) should not have self-intersections also following case is not supported (vertex -> edge (incident with vertex)):
vert path edge point path edge end o-------—o- – – – – O \ \ / \ \ / \ \ / \/ o path
MRMESH_API CutMeshResult MR::cutMesh | ( | Mesh & | mesh, |
const OneMeshContours & | contours, | ||
const CutMeshParameters & | params = {} ) |
Cuts mesh by given contours.
This function cuts mesh making new edges paths on place of input contours
mesh | Input mesh that will be cut |
contours | Input contours to cut mesh with, find more MR::OneMeshContours |
params | Parameters describing some cut options, find more MR::CutMeshParameters |
bad faces
) will not be allowed for fill bad faces
are in mesh, mesh will be spoiled, MRMESH_API std::vector< EdgePath > MR::cutMeshWithPlane | ( | Mesh & | mesh, |
const Plane3f & | plane, | ||
FaceMap * | mapNew2Old = nullptr ) |
Simple cut mesh by plane.
This function cuts mesh with plane, leaving only part of mesh that lay in positive direction of normal
mesh | Input mesh that will be cut |
plane | Input plane to cut mesh with |
mapNew2Old | (this is optional output) map from newly generated faces to old faces (N-1) |
MRMESH_API Expected< Mesh > MR::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 = {} ) |
Perform boolean operation on cut meshes
MRMESH_API Expected< BooleanResultPoints, std::string > MR::getBooleanPoints | ( | const Mesh & | meshA, |
const Mesh & | meshB, | ||
BooleanOperation | operation, | ||
const AffineXf3f * | rigidB2A = nullptr ) |
Returns the points of mesh boolean's result mesh.
Returns vertices and intersection points of mesh that is result of boolean operation of mesh A
and mesh B
. Can be used as fast alternative for cases where the mesh topology can be ignored (bounding box, convex hull, etc.)
meshA | Input mesh A |
meshB | Input mesh B |
operation | Boolean operation to perform |
rigidB2A | Transform from mesh B space to mesh A space |