Extract isosurface data from volume data
fv = isosurface(X,Y,Z,V,isovalue)
fv = isosurface(V,isovalue)
fvc = isosurface(...,colors)
fv = isosurface(...,'noshare')
fv = isosurface(...,'verbose')
[f,v] = isosurface(...)
[f,v,c] = isosurface(...)
fv = isosurface(X,Y,Z,V,isovalue) computes
isosurface data from the volume data
V at the isosurface
value specified in
isovalue. That is, the isosurface
connects points that have the specified value much the way contour
lines connect points of equal elevation.
a Cartesian, axis-aligned grid.
V contains the
corresponding values at these grid points. The coordinate arrays (
Z) must be monotonic and conform to the format
be a 3D volume array of the same size as
fv = isosurface(V,isovalue) assumes
[X,Y,Z] = meshgrid(1:n,1:m,1:p) where
fvc = isosurface(...,colors) interpolates
colors onto the scalar field and returns
the interpolated values in the
fvc structure. The size of the
must be the same as
enables you to control the color mapping of the isosurface with data
different from that used to calculate the isosurface (e.g., temperature
data superimposed on a wind current isosurface).
fv = isosurface(...,'noshare') does
not create shared vertices. This is faster, but produces a larger
set of vertices.
fv = isosurface(...,'verbose') prints
progress messages to the command window as the computation progresses.
[f,v] = isosurface(...) or
[f,v,c] = isosurface(...) returns
the faces and vertices (and
separate arrays instead of a struct.
isosurface(...) with no
output arguments, creates a patch in the current axes with the computed
faces and vertices. If no current axes exists, a new axes is created
with a 3-D view.
If there is no current axes and you call
isosurface without assigning
output arguments, MATLAB® creates a new axes, sets it to a 3-D view, and adds lighting to the isosurface
Load the flow data set, which represents the speed profile of a submerged jet within an infinite tank. Draw the isosurface at the data value of
-3 and prepare the isosurface for lighting by:
Recalculating the isosurface normals based on the volume data.
Setting the face and edge color.
Specifying the view.
[x,y,z,v] = flow; p = patch(isosurface(x,y,z,v,-3)); isonormals(x,y,z,v,p) p.FaceColor = 'red'; p.EdgeColor = 'none'; daspect([1 1 1]) view(3); axis tight camlight lighting gouraud
Visualize the flow data, but color-code the surface to indicate magnitude along the x-axis. Use a sixth argument to
isosurface, which provides a means to overlay another data set by coloring the resulting isosurface. The
colors variable is a vector containing a scalar value for each vertex in the isosurface, to be portrayed with the current color map. In this case, it is one of the variables that define the surface, but it could be entirely independent. You can apply a different color scheme by changing the current figure color map.
[x,y,z,v] = flow; [faces,verts,colors] = isosurface(x,y,z,v,-3,x); patch('Vertices',verts,'Faces',faces,'FaceVertexCData',colors,... 'FaceColor','interp','EdgeColor','interp') view(30,-15) axis vis3d colormap copper
You can pass the
fv structure created by
patch command, but you
cannot pass the individual faces and vertices arrays (
patch without specifying property names. For
[f,v] = isosurface(X,Y,Z,V,isovalue); patch('Faces',f,'Vertices',v)