Main Content

isWatertight

Check if surface mesh is watertight

Since R2022b

    Description

    example

    TF = isWatertight(mesh) checks if the mesh is watertight. A mesh is watertight when it is edge-manifold and vertex-manifold, but not self-intersecting.

    Examples

    collapse all

    Define mesh vertices and faces for the 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];
    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];

    Create and display the surface mesh.

    mesh = surfaceMesh(vertices,faces);
    surfaceMeshShow(mesh,Title="Input Mesh")

    Check if the mesh is watertight.

    TF = isWatertight(mesh)
    TF = logical
       1
    
    

    Input Arguments

    collapse all

    Surface mesh, specified as a surfaceMesh object.

    Output Arguments

    collapse all

    Surface mesh is watertight, returned as a logical 0 (false) or 1 (true). The function returns true when the mesh is watertight. Otherwise, it returns false.

    Version History

    Introduced in R2022b