surfaceMeshShow
Syntax
Description
surfaceMeshShow(
displays the
surface mesh specified by the surfaceMeshObj
)surfaceMesh
object
surfaceMeshObj
.
surfaceMeshShow(
displays the
surface mesh specified by the triangulationObj
)triangulation
object.
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
Display Surface Mesh Using surfaceMesh
Object
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")
Display Surface Mesh Using triangulation
Object
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
surfaceMeshObj
— Surface mesh data
surfaceMesh
object
Surface mesh data, specified as a surfaceMesh
object.
triangulationObj
— Triangulation of surface mesh
triangulation
object
Triangulation of surface mesh, specified as a triangulation
object.
vertices
— Mesh vertices
M-by-3 matrix
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.
faces
— Mesh triangular faces
N-by-3 matrix
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
— Colormap for surface mesh
'parula'
(default) | character vector | string scalar
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
.
BackgroundColor
— Background color
[0 0 0]
(default) | RGB triplet | hexadecimal color code | color name | short color name
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 from0
toF
. 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 Name | Short Name | RGB Triplet | Hexadecimal 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" |
Alpha
— Transparency of surface mesh
1
(default) | positive scalar in range [0, 1]
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
WireFrame
— Display mesh surface as wireframe
false
(default) | true
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
VerticesOnly
— Display only mesh vertices
false
(default) | true
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
— Title for surface mesh display
" "
(default) | character vector | string scalar
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
— Parent
Viewer3D
object
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 R2022bR2023b: Specify Viewer3D
object as Parent
,and support for savefig
function
You can now specify a
Viewer3D
object as a parent to thesurfaceMeshShow
function by using theParent
name-value argument.The
surfaceMeshShow
function displays the mesh with face colors specified by theFaceColors
property of the inputsurfaceMesh
object.You can save the output by using the
savefig
function.
See Also
MATLAB 命令
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 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)