Products & Services Solutions Academia Support User Community Company

Learn more about MATLAB   

trimesh - Triangular mesh plot

Syntax

trimesh(Tri,X,Y,Z,C)
trimesh(Tri,X,Y,Z)
trimesh(Tri, X, Y)
trimesh(TR)
trimesh(...'PropertyName',PropertyValue...)
h = trimesh(...)

Description

trimesh(Tri,X,Y,Z,C) displays triangles defined in the m-by-3 face matrix Tri as a mesh. Each row of Tri defines a single triangular face by indexing into the vectors or matrices that contain the X, Y, and Z vertices. The edge color is defined by the vector C.

trimesh(Tri,X,Y,Z) uses C = Z so color is proportional to surface height.

trimesh(Tri, X, Y) displays the triangles in a 2-D plot.

trimesh(TR) displays the triangles in a TriRep triangulation representation.

trimesh(...'PropertyName',PropertyValue...) specifies additional patch property names and values for the patch graphics object created by the function.

h = trimesh(...) returns a handle to the displayed triangles.

Example

Create vertex vectors and a face matrix, then create a triangular mesh plot.

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

If the surface is already a triangulation representation it may be plotted as follows:

tr = TriRep(tri, x(:), y(:), z(:));
trimesh(tr)

See Also

patch, trisurf, delaunay, DelaunayTri, TriRep

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS