MeshLib
 
Loading...
Searching...
No Matches
Mesh extrude

Example of extrude faces on mesh

#include <MRMesh/MRId.h>
#include <MRMesh/MRMesh.h>
int main()
{
// Load mesh
// Select faces to extrude
MR::FaceBitSet facesToExtrude;
facesToExtrude.autoResizeSet( MR::FaceId( 1 ) );
facesToExtrude.autoResizeSet( MR::FaceId( 2 ) );
// Create duplicated verts on region boundary
MR::makeDegenerateBandAroundRegion( mesh, facesToExtrude );
// Find vertices that will be moved
auto vertsForMove = MR::getIncidentVerts( mesh.topology, facesToExtrude );
MR::BitSetParallelFor( vertsForMove, [&] ( MR::VertId v )
{
// Move each vertex
} );
// Invalidate internal caches after manual changing
// Save mesh
MR::MeshSave::toAnySupportedFormat( mesh, "extrudedMesh.stl" );
}
auto BitSetParallelFor(const BS &bs, F &&f, Cb &&... cb)
Definition MRBitSetParallelFor.h:189
MRMESH_API Expected< Mesh > fromAnySupportedFormat(const std::filesystem::path &file, const MeshLoadSettings &settings={})
detects the format from file extension and loads mesh from it
MRMESH_API VoidOrErrStr toAnySupportedFormat(const Mesh &mesh, const std::filesystem::path &file, const SaveSettings &settings={})
detects the format from file extension and save mesh to it
MRMESH_API void makeDegenerateBandAroundRegion(Mesh &mesh, const FaceBitSet &region, const MakeDegenerateBandAroundRegionParams &params={})
Create a band of degenerate faces along the border of the specified region and the rest of the mesh.
MRMESH_API VertBitSet getIncidentVerts(const MeshTopology &topology, const FaceBitSet &faces)
composes the set of all vertices incident to given faces
Definition MRMesh/MRMesh.h:23
MeshTopology topology
Definition MRMesh/MRMesh.h:24
VertCoords points
Definition MRMesh/MRMesh.h:25
MRMESH_API void invalidateCaches(bool pointsChanged=true)
static constexpr Vector3 plusZ() noexcept
Definition MRMesh/MRVector3.h:35