MATLAB Function Reference    
surf2patch

Convert surface data to patch data

Syntax

Description

fvc = surf2patch(h) converts the geometry and color data from the surface object identified by the handle h into patch format and returns the face, vertex, and color data in the struct fvc. You can pass this struct directly to the patch command.

fvc = surf2patch(Z) calculates the patch data from the surface's ZData matrix Z.

fvc = surf2patch(Z,C) calculates the patch data from the surface's ZData and CData matrices Z and C.

fvc = surf2patch(X,Y,Z) calculates the patch data from the surface's XData, YData, and ZData matrices X, Y, and Z.

fvc = surf2patch(X,Y,Z,C) calculates the patch data from the surface's XData, YData, ZData, and CData matrices X, Y, Z, and C.

fvc = surf2patch(...,'triangles') creates triangular faces instead of the quadrilaterals that compose surfaces.

[f,v,c] = surf2patch(...) returns the face, vertex, and color data in the three arrays f, v, and c instead of a struct.

Examples

The first example uses the sphere command to generate the XData, YData, and ZData of a surface, which is then converted to a patch. Note that the ZData (z) is passed to surf2patch as both the third and fourth arguments - the third argument is the ZData and the fourth argument is taken as the CData. This is because the patch command does not automatically use the z-coordinate data for the color data, as does the surface command.

Also, because patch is a low-level command, you must set the view to 3-D and shading to faceted to produce the same results produced by the surf command.

In the second example surf2patch calculates face, vertex, and color data from a surface whose handle has been passed as an argument.

See Also

patch, reducepatch, shrinkfaces, surface, surf

Volume Visualization for related functions


  surf, surfc surface 

Learn more about the latest releases of MathWorks products:

 © 1994-2009 The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS