MATLAB Functions Help Desk

surfnorm

Purpose

Compute and display 3-D surface normals

Syntax

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 is a matrix that defines the z component of the Surface. X and Y are vectors or matrices that define the x and y components of the Surface.

[Nx,Ny,Nz] = surfnorm(...) returns the components of the three-dimensional surface normals for the Surface.

Remarks

The direction of the normals is reversed by calling surfnorm with transposed arguments:

surfl uses surfnorm to compute surface normals when calculating the reflectance of a Surface.

Algorithm

The surface normals are based on a bicubic fit of the data in X, Y, and Z. For each vertex, diagonal vectors are computed and crossed to form the normal.

Examples

Plot the normal vectors for a truncated cone.

See Also

surfl



[ Previous | Help Desk | Next ]