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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

surfnormPurpose2surfnormCompute and display 3-D surface normalsSyntaxsurfnorm(Z)surfnorm(X,Y,Z)[Nx,Ny,Nz] = surfnorm(...)Description The surfnorm function computes surface normals for the surface defined by X,Y, and Z. The surface normals are unnormalized and valid at each vertex.Normals are not shown for surface elements that face away from the viewer.surfnorm(Z) and surfnorm(X,Y,Z) plot a surface and its surface normals. Z isa matrix that defines the z component of the surface. X and Y are vectors ormatrices that define the x and y components of the surface.[Nx,Ny,Nz] = surfnorm(...) returns the components of thethree-dimensional surface normals for the surface.RemarksThe direction of the normals is reversed by calling surfnorm with transposedarguments:surfnorm(X',Y',Z')surfl uses surfnorm to compute surface normals when calculating thereflectance of a surface.AlgorithmExamplesThe surface normals are based on a bicubic fit of the data in X, Y, and Z. Foreach vertex, diagonal vectors are computed and crossed to form the normal.Plot the normal vectors for a truncated cone.[x,y,z] = cylinder(1:10);surfnorm(x,y,z)axis([−12 12 −12 12 −0.1 1])2-497

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

Saved successfully!

Ooh no, something went wrong!