Main Content

surfaceMeshShow

Display surface mesh

    Description

    example

    surfaceMeshShow(surfaceMeshObj) displays the surface mesh specified by the surfaceMesh object surfaceMeshObj.

    surfaceMeshShow(triangulationObj) displays the surface mesh specified by the triangulation object.

    surfaceMeshShow(vertices,faces) displays the surface mesh defined by the input vertices and faces.

    example

    surfaceMeshShow(___,Name=Value) specifies options using one or more name-value arguments in addition to any combination of arguments from previous syntaxes. For example, Title="Cuboid" displays the surface mesh with the title "Cuboid".

    Examples

    collapse all

    Define the mesh vertices and faces for a surface mesh.

    vertices = [0 0 0; 0 0 1; 0 1 1; 0 0 2; 1 0.5 1];
    faces = [1 2 3; 2 3 4; 2 3 5];

    Create a surfaceMesh object using vertices and faces.

    mesh = surfaceMesh(vertices,faces);

    Display the surface mesh.

    surfaceMeshShow(mesh,Title="Surface Mesh",ColorMap="hot",BackgroundColor="blue")

    Create a triangulation object that represents a 3-D triangulation.

    [x,y] = meshgrid(1:15,1:15);
    tri = delaunay(x,y);
    z = peaks(15);
    triangulationObject = triangulation(tri,x(:),y(:),z(:));

    Display the surface mesh defined by the triangulation.

    surfaceMeshShow(triangulationObject,ColorMap="summer",Title="Triangulation Obj Mesh")

    Input Arguments

    collapse all

    Surface mesh data, specified as a surfaceMesh object.

    Triangulation of surface mesh, specified as a triangulation object.

    Mesh vertices, specified as an M-by-3 matrix. Each row of the matrix is of the form [x y z], specifying the coordinates of a vertex. Each vertex has a vertex ID equal to its row number in the matrix. M is the total number of vertices.

    Mesh triangular faces, specified as an N-by-3 matrix. Each row of the matrix is of the form [V1 V2 V3], specifying the vertex IDs of the vertices that define the triangular face. N is the number of faces.

    Name-Value Arguments

    Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

    Example: surfaceMeshShow(mesh,Title="Cuboid") displays the surface mesh with the title "Cuboid".

    Colormap for the surface mesh, specified as one of these options.

    • parula

    • turbo

    • hsv

    • hot

    • cool

    • spring

    • summer

    • autumn

    • winter

    • gray

    • bone

    • copper

    • pink

    • jet

    • lines

    • colorcube

    • prism

    • flag

    • white

    For more information, see colormap.

    Background color for the surface mesh, specified as one of these options.

    • RGB Triplet — A three-element row vector whose elements specify the intensities of the red, green, and blue components of the color. The intensities must be in the range [0,1]; for example, [0.4 0.6 0.7].

    • Hexadecimal Color Code — A character vector or a string scalar that starts with a hash symbol (#) followed by three or six hexadecimal digits, which can range from 0 to F. The values are not case sensitive. Thus, the color codes '#FF8800', '#ff8800', '#F80', and '#f80' are equivalent.

    • Color Name or Short Name — Specify the name of a color such as 'red' or 'green'. Short names specify a letter from a color name, such as 'r' or 'g'.

    RGB triplets and hexadecimal color codes are useful for specifying custom colors.

    This table lists the named color options, the equivalent RGB triplets, and hexadecimal color codes.

    Color NameShort NameRGB TripletHexadecimal Color Code
    "red""r"[1 0 0]"#FF0000"
    "green""g"[0 1 0]"#00FF00"
    "blue""b"[0 0 1]"#0000FF"
    "cyan" "c"[0 1 1]"#00FFFF"
    "magenta""m"[1 0 1]"#FF00FF"
    "yellow""y"[1 1 0]"#FFFF00"
    "black""k"[0 0 0]"#000000"
    "white""w"[1 1 1]"#FFFFFF"

    Transparency of the surface mesh, specified as a positive scalar in the range [0, 1]. A value of 1 is fully opaque, 0 is completely transparent, and values in between them are semitransparent.

    Data Types: single | double

    Display the mesh surface as a wireframe, specified as a logical true or false. When set to true, the function displays the mesh surfaces as a wireframe. Otherwise, the surface has a solid fill.

    Data Types: logical

    Display only mesh vertices, specified as a logical true or false. When set to true, the function displays only the mesh vertices.

    Data Types: logical

    Title for the surface mesh display, specified as a character vector or string scalar. This value is empty by default.

    Data Types: char | string

    Limitations

    The surfaceMeshShow function does not display mesh face colors specified by the FaceColors property of the input surfaceMesh object.

    You cannot save the output by using the savefig function.

    To use functions such as plot after the surfaceMeshShow function, you must create a new figure window. The surfaceMeshShow function cannot create figures.

    Version History

    Introduced in R2022b