Contenido principal

surfaceMeshShow

Display surface mesh

Since R2022b

    Description

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

    example

    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.

    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".

    example

    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 Viewer3D object to display the surface mesh.

    viewer = viewer3d;

    viewer.CameraPosition = [-2 2 0];
    viewer.CameraZoom = 0.5;
    surfaceMeshShow(mesh,Parent=viewer,Title="Surface Mesh With Viewer")

    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 Object 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

    collapse all

    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.

    Colormap NameColor Scale

    parula

    Colorbar showing the colors of the parula colormap. The colormap starts at dark blue and transitions to lighter blue, green, orange and yellow. The transitions between colors are more perceptually uniform than in most other colormaps.

    turbo

    Colorbar showing the colors of the turbo colormap. The colormap starts at dark blue and transitions to lighter blue, bright green, orange, yellow, and dark red. This colormap is similar to jet, but the transitions between colors are more perceptually uniform than in jet.

    hsv

    Colorbar showing the colors of the hsv colormap. The colormap starts at red and transitions to yellow, bright green, cyan, dark blue, magenta, and bright orange.

    hot

    Colorbar showing the colors of the hot colormap. The colormap starts at dark red and transitions to bright red, orange, yellow, and white.

    cool

    Colorbar showing the colors of the cool colormap. The colormap starts at cyan and transitions to light blue, light purple, and magenta.

    spring

    Colorbar showing the colors of the spring colormap. The colormap starts at magenta and transitions to pink, light orange, and yellow.

    summer

    Colorbar showing the colors of the summer colormap. The colormap starts at medium green and transitions to yellow.

    autumn

    Colorbar showing the colors of the autumn colormap. The colormap starts at bright orange and transitions to yellow.

    winter

    Colorbar showing the colors of the winter colormap. The colormap starts at dark blue and transitions to bright green.

    gray

    Colorbar showing the gray colormap. The colormap starts at black and transitions to white.

    bone

    Colorbar showing the bone colormap. This colormap has colors that are approximately gray with a slight blue color tint. The colormap starts at dark gray and transitions to white.

    copper

    Colorbar showing the copper colormap. This colormap starts at black and transitions to a medium orange, similar to the color of copper.

    pink

    Colorbar showing the pink colormap. This colormap starts at dark red and transitions to dark pink, tan, and white.

    sky (since R2023a)

    Colorbar showing the sky colormap. This colormap starts at a very light shade of blue and transitions to a darker shade of blue.

    abyss (since R2023b)

    Colorbar showing the abyss colormap. This colormap starts at a very dark shade of blue and transitions to a lighter shade of blue.

    nebula (since R2025a)

    Colorbar showing the nebula colormap. This colormap starts at a medium shade of blue and transitions to a bright shade of red.

    jet

    Colorbar showing the colors of the jet colormap. The colormap starts at dark blue and transitions to light blue, bright green, orange, yellow, and dark red.

    lines

    Colorbar showing the colors of the lines colormap. The colormap contains a repeating pattern of colors: dark blue, dark orange, dark yellow, dark purple, medium green, light blue, and dark red.

    colorcube

    Colorbar showing the colors of the colorcube colormap. The colormap is a course sampling of the RGB colorspace.

    prism

    Colorbar showing the colors of the prism colormap. The colormap contains a repeating pattern of colors: red, orange, yellow, green, blue, and purple.

    flag

    Colorbar showing the colors of the flag colormap. The colormap contains a repeating pattern of colors: red, white, blue, and black.

    white

    Colorbar showing the white colormap, which is entirely 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 makes the mesh fully opaque, 0 makes it completely transparent, and values in between produce semi-transparency

    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

    Parent of the surfaceMesh object, specified as a Viewer3D object. You can create a Viewer3D object using the viewer3d function. When you call surfaceMeshShow without specifying a parent, the function creates a new Viewer3D object and sets that object as the parent. You cannot reparent a surfaceMesh object

    Version History

    Introduced in R2022b

    expand all