trisurf

Plots a triangular surface with shaded faces.

Category: Mathematics > Computational Geometry

Syntax

trisurf(T, x, y, z)

Draws the triangles T as a surface with vertex heights z, colored by height.

trisurf(T, x, y, z, C)

Colors the surface using the values in C.

trisurf(TR)

Draws a triangulation object.

h = trisurf(___)

Also returns the patch handle.

Description

trisurf is the filled counterpart of trimesh: each triangle becomes a colored face and the edges are drawn in black. It is the way to plot a surface defined on scattered points, since a triangulation of the (x, y) locations (from delaunay) supplies the connectivity.

Input arguments

T
m-by-3 matrix of vertex indices, one triangle per row.
x, y, z
Vectors with the vertex coordinates.
C
Optional color data, one value per vertex.

Output arguments

h
Handle to the patch object.

Example

Surface over scattered points

rng(1);
x = rand(20, 1);
y = rand(20, 1);
z = x .* y;
T = delaunay(x, y);
trisurf(T, x, y, z);

See also

trimesh triplot delaunay surf