isocaps

Computes the faces that close the open ends of an isosurface where it meets the volume boundary.

Category: Graphics > 2-D and 3-D Plots

Syntax

fv = isocaps(X, Y, Z, V, isovalue)

Returns a structure of cap faces for the data V on the grid (X, Y, Z).

fv = isocaps(V, isovalue)

Uses the grid 1:n in each direction.

fv = isocaps(___, which)

Selects which caps to compute: 'above' or 'below' the isovalue.

[f, v, c] = isocaps(___)

Returns faces, vertices and colors as separate arrays.

Description

An isosurface made with isosurface is open wherever it leaves the volume, like a hollow shell cut off at the edges. isocaps produces polygons that fill those openings and are colored by the data, so the cut looks solid. Draw both with patch.

Input arguments

X, Y, Z
Coordinate arrays, as from meshgrid.
V
3-D array of scalar volume data.
isovalue
Value that defines the surface.

Output arguments

fv
Structure with the fields vertices, faces and facevertexcdata, ready for patch.

Example

Caps as a patch structure

[x, y, z] = meshgrid(-1:0.5:1);
v = x.^2 + y.^2 + z.^2;
fv = isocaps(x, y, z, v, 0.5);
fieldnames(fv)
size(fv.faces, 2)
Output
ans = 3×1 cell

    {'vertices'       }
    {'faces'          }
    {'facevertexcdata'}
ans = 3

See also

isosurface isonormals isocolors patch smooth3