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.

surf2patchPurpose2surf2patchConvert surface data to patch dataSyntaxDescriptionfvc = surf2patch(h)fvc = surf2patch(Z)fvc = surf2patch(Z,C)fvc = surf2patch(X,Y,Z)fvc = surf2patch(X,Y,Z,C)fvc = surf2patch(...,'triangles')[f,v,c] = surf2patch(...)fvc = surf2patch(h) converts the geometry and color data from the surfaceobject 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 patchcommand.fvc = surf2patch(Z) calculates the patch data from the surface’s ZDatamatrix Z.fvc = surf2patch(Z,C) calculates the patch data from the surface’s ZData andCData 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’sXData, YData, ZData, and CData matrices X, Y, Z, and C.fvc = surf2patch(...,'triangles') creates triangular faces instead of thequadrilaterals that compose surfaces.[f,v,c] = surf2patch(...) returns the face, vertex, and color data in thethree arrays f, v, and c instead of a struct.ExamplesThe first example uses the sphere command to generate the XData, YData, andZData 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 thirdargument is the ZData and the fourth argument is taken as the CData. This isbecause the patch command does not automatically use the z-coordinate datafor the color data, as does the surface command.2-472

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

Saved successfully!

Ooh no, something went wrong!