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::NewEdgesMap |
| 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 CutMeshResult | MR::cutMesh (Mesh &mesh, const OneMeshContours &contours, const CutMeshParameters ¶ms={}) |
| Cuts mesh by given contours. | |
| MRMESH_API Expected< OneMeshContours > | MR::convertMeshTriPointsSurfaceOffsetToMeshContours (const Mesh &mesh, const std::vector< MeshTriPoint > &surfaceLine, float offset, SearchPathSettings searchSettings={}) |
| Makes continuous contour by iso-line from mesh tri points, if first and last meshTriPoint is the same, makes closed contour. | |
| MRMESH_API Expected< OneMeshContours > | MR::convertMeshTriPointsSurfaceOffsetToMeshContours (const Mesh &mesh, const std::vector< MeshTriPoint > &surfaceLine, const std::function< float(int)> &offsetAtPoint, SearchPathSettings searchSettings={}) |
| Makes continuous contour by iso-line from mesh tri points, if first and last meshTriPoint is the same, makes closed contour. | |
| 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. | |
| MR_BIND_IGNORE MRMESH_API Expected< OneMeshContour > | MR::convertMeshTriPointsToMeshContour (const Mesh &mesh, const std::vector< MeshTriPoint > &surfaceLine, MeshTriPointsConnector connectorFn, 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 > | MR::convertMeshTriPointsToMeshContour (const Mesh &mesh, const std::vector< MeshTriPoint > &surfaceLine, 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 > | MR::convertMeshTriPointsToClosedContour (const Mesh &mesh, const std::vector< MeshTriPoint > &surfaceLine, 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. | |
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 continuous contour by iso-line from mesh tri points, if first and last meshTriPoint is the same, makes closed contour.
Finds shortest paths between neighbor surfaceLine and build offset contour on surface for MR::cutMesh input
| offsetAtPoint | functor that returns amount of offset form arg point, note that absolute value is used and isoline in both direction returned |
| searchSettings | settings for search geodesic path |
|
nodiscard |
Makes continuous contour by iso-line from mesh tri points, if first and last meshTriPoint is the same, makes closed contour.
Finds shortest paths between neighbor surfaceLine and build offset contour on surface for MR::cutMesh input
| offset | amount of offset form given point, note that absolute value is used and isoline in both direction returned |
| searchSettings | settings for search geodesic path |
|
nodiscard |
Makes closed continuous contour by mesh tri points, note that first and last meshTriPoint should not be same.
Finds shortest paths between neighbor surfaceLine and build closed contour MR::cutMesh input
| pivotIndices | optional output indices of given surfaceLine in result OneMeshContour |
|
nodiscard |
Makes continuous contour by mesh tri points, if first and last meshTriPoint is the same, makes closed contour.
Finds paths between neighbor surfaceLine with MeshTriPointsConnector function and build contour MR::cutMesh input
| connectorFn | function to build path between neighbor surfaceLine, if not present simple geodesic path function is used |
| pivotIndices | optional output indices of given surfaceLine 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 surfaceLine and build contour MR::cutMesh input
| searchSettings | settings for search geo path |
| pivotIndices | optional output indices of given surfaceLine 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 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 |