MATLAB Function Reference Previous page   Next Page

Compute normals of isosurface vertices



n = isonormals(X,Y,Z,V,vertices) computes the normals of the isosurface vertices from the vertex list, vertices, using the gradient of the data V. The arrays X, Y, and Z define the coordinates for the volume V. The computed normals are returned in n.

n = isonormals(V,vertices) assumes the arrays X, Y, and Z are defined as [X,Y,Z] = meshgrid(1:n,1:m,1:p) where [m,n,p] = size(V).

n = isonormals(V,p) and n = isonormals(X,Y,Z,V,p) compute normals from the vertices of the patch identified by the handle p.

n = isonormals(...,'negate') negates (reverses the direction of) the normals.

isonormals(V,p) and isonormals(X,Y,Z,V,p) set the VertexNormals property of the patch identified by the handle p to the computed normals rather than returning the values.


This example compares the effect of different surface normals on the visual appearance of lit isosurfaces. In one case, the triangles used to draw the isosurface define the normals. In the other, the isonormals function uses the volume data to calculate the vertex normals based on the gradient of the data points. The latter approach generally produces a smoother-appearing isosurface.

Define a 3-D array of volume data (cat, interp3):

Draw an isosurface from the volume data and add lights. This isosurface uses triangle normals (patch, isosurface, view, daspect, axis, camlight, lighting, title):

Draw the same lit isosurface using normals calculated from the volume data:

These isosurfaces illustrate the difference between triangle and data normals:

See Also

interp3, isosurface, isocaps, smooth3, subvolume, reducevolume, reducepatch

Volume Visualization for related functions

Previous page  isocolors isosurface Next page

© 1994-2005 The MathWorks, Inc.