removeFaces
Description
Examples
Remove Faces from Surface Mesh
Define mesh vertices for a surface mesh.
vertices = [1 -1 1; 1 1 1; -1 1 1; -1 -1 1; ... 1 -1 -1; 1 1 -1; -1 1 -1; -1 -1 -1; ... 0 0 2; 0 0 -2];
Define the mesh faces using the vertices.
faces = [6 2 1; 1 5 6; 8 4 3; 3 7 8; 6 7 3; 3 2 6; ... 5 1 4; 4 8 5; 4 1 2; 2 3 4; 7 6 5; 5 8 7; ... 1 4 9; 2 3 9; 5 8 10; 6 7 10];
Create and display the surface mesh.
mesh = surfaceMesh(vertices,faces);
surfaceMeshShow(mesh,Title="Original Mesh")
Remove the faces 13th and 14th from the mesh by specifying their face IDs, remove the resulting unreferenced vertices from the mesh. Visualize the output.
faceIDs = [13 14]; removeFaces(mesh,faceIDs) removeDefects(mesh,"unreferenced-vertices") surfaceMeshShow(mesh,Title="Mesh After Removing Faces")
Remove Faces from Surface Mesh Using Binary Mask
Define mesh vertices for a surface mesh.
vertices = [1 -1 1; 1 1 1; -1 1 1; -1 -1 1; ... 1 -1 -1; 1 1 -1; -1 1 -1; -1 -1 -1; ... 0 0 2; 0 0 -2];
Define the mesh faces using the vertices.
faces = [6 2 1; 1 5 6; 8 4 3; 3 7 8; 6 7 3; 3 2 6; ... 5 1 4; 4 8 5; 4 1 2; 2 3 4; 7 6 5; 5 8 7; ... 1 4 9; 2 3 9; 5 8 10; 6 7 10];
Create and display the surface mesh.
mesh = surfaceMesh(vertices,faces);
surfaceMeshShow(mesh,Title="Original Mesh")
Mark 13,14 vertices as true
and remaining vertices as false
to generate a binary mask.
faceMask = false(1,mesh.NumFaces); faceMask([13 14]) = true;
Remove faces 13 and 14 face from the mesh by using the removeFaces
function, and remove the resulting unreferenced vertices. Visualize the output.
removeFaces(mesh,faceMask); removeDefects(mesh,"unreferenced-vertices") surfaceMeshShow(mesh,Title="Mesh After Removing Faces")
Input Arguments
mesh
— Surface mesh
surfaceMesh
object
Surface mesh, specified as a surfaceMesh
object.
faceIDs
— Face IDs
n-element vector
Face IDs, specified as an n-element vector. Each face ID is a
unique identifier for a face in the mesh and is equal to the row number of the face in
the Faces
property of the surfaceMesh
object. n is the number of faces to remove from the mesh.
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
faceMask
— Binary mask with mesh faces
N-element logical vector
Binary mask with mesh faces, specified as an N-element logical
vector. N is the total number of mesh faces. If the value of an
element is true
, the function removes the corresponding face from the
mesh. If an element is false
, the function does not remove the
corresponding face from the mesh.
Version History
Introduced in R2022b
See Also
addFaces
| addVertices
| removeVertices
| surfaceMesh
| pc2surfacemesh
| readSurfaceMesh
| writeSurfaceMesh
| surfaceMeshShow
Abrir ejemplo
Tiene una versión modificada de este ejemplo. ¿Desea abrir este ejemplo con sus modificaciones?
Comando de MATLAB
Ha hecho clic en un enlace que corresponde a este comando de MATLAB:
Ejecute el comando introduciéndolo en la ventana de comandos de MATLAB. Los navegadores web no admiten comandos de MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)