12.07.2015 Views

MATLAB Function Reference (Volume 2: Graphics)

MATLAB Function Reference (Volume 2: Graphics)

MATLAB Function Reference (Volume 2: Graphics)

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

isonormalsPurpose2isonormalsCompute normals of isosurface verticesSyntaxDescriptionn = isonormals(X,Y,Z,V,vertices)n = isonormals(V,vertices)n = isonormals(V,p), n = isonormals(X,Y,Z,V,p)n = isonormals(...,'negate')isonormals(V,p), isonormals(X,Y,Z,V,p)n = isonormals(X,Y,Z,V,vertices) computes the normals of the isosurfacevertices from the vertex list, vertices, using the gradient of the data V. Thearrays X, Y, and Z define the coordinates for the volume V. The computednormals 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 fromthe vertices of the patch identified by the handle p.n = isonormals(...,'negate') negates (reverses the direction of) thenormals.isonormals(V,p) and isonormals(X,Y,Z,V,p) set the VertexNormalsproperty of the patch identified by the handle p to the computed normals ratherthan returning the values.ExamplesThis example compares the effect of different surface normals on the visualappearance of lit isosurfaces. In one case, the triangles used to draw theisosurface define the normals. In the other, the isonormals function uses thevolume data to calculate the vertex normals based on the gradient of the datapoints. The latter approach generally produces a smoother-appearingisosurface.Define a 3-D array of volume data (cat, interp3):data = cat(3, [0 .2 0; 0 .3 0; 0 0 0], ...[.1 .2 0; 0 1 0; .2 .7 0],...[0 .4 .2; .2 .4 0;.1 .1 0]);data = interp3(data,3,'cubic');2-253

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!