3-D Visualization |
Defining Isocaps
Isocaps, like isosurfaces, are created as patch
graphics objects. Use the isocaps
command to generate the data to pass to patch
. For example,
creates isocaps for the scalar volume data voldata
at the value isoval
. You should create the isosurface using the same volume data and isovalue to ensure that the edges of the isocaps fit the isosurface.
Setting the patch FaceColor
property to interp
results in a coloring that maps the data values spanned by the isocap to colormap entries. You can also set other patch properties to control the effects of lighting and coloring on the isocaps.
Example -- Adding Isocaps to an Isosurface
This example illustrates how to set coloring and lighting characteristics when working with isocaps. There are five basic steps:
1. Prepare the Data
This example uses a 3-D array of random (rand
) data to define the volume data. The data is then smoothed (smooth3
).
2. Create the Isosurface and Set Properties
Use isosurface
and patch
to create the isosurface and set coloring and lighting properties. Reduce the AmbientStrength
, SpecularStrength
, and DiffuseStrength
of the reflected light to compensate for the brightness of the two light sources used to provide more uniform lighting.
Recalculate the vertex normals of the isosurface to produce smoother lighting (isonormals
).
isoval = .5; h = patch(isosurface(data,isoval),... 'FaceColor','blue',... 'EdgeColor','none',... 'AmbientStrength',.2,... 'SpecularStrength',.7,... 'DiffuseStrength',.4); isonormals(data,h)
3. Create the Isocaps and Set Properties
Define the isocaps
using the same data and isovalue as the isosurface. Specify interpolated coloring and select a colormap that provides better contrasting colors with the blue isosurface than those in the default colormap (colormap
).
4. Define the View
Set the data aspect ratio to [1,1,1]
so that the display is in correct proportions (daspect
). Eliminate white space within the axes and set the view to 3-D (axis
tight
, view
).
5. Add Lighting
To add fairly uniform lighting, but still take advantage of the ability of light sources to make visible subtle variations in shape, this example uses two lights, one to the left and one to the right of the camera (camlight
). Use Phong lighting to produce the smoothest variation of color (lighting
). Phong lighting requires the zbuffer
renderer.
Isocaps Add Context to Visualizations | Visualizing Vector Volume Data |
© 1994-2005 The MathWorks, Inc.