Main Content

vertexCenter

Find vertex center of surface mesh

Since R2022b

    Description

    example

    vertexCenter(mesh) finds the center of the mesh vertices of the surface mesh mesh. The vertex center is the mean value of all vertices.

    Examples

    collapse all

    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];

    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];

    Create and display the surface mesh.

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

    Find the vertex center of the surface mesh and display its coordinates.

    center = vertexCenter(mesh);
    disp(center)
         0     0     0
    

    Input Arguments

    collapse all

    Surface mesh, specified as a surfaceMesh object.

    Version History

    Introduced in R2022b