3-D Visualization |
Behavior of the patch Function
There are two forms of the patch
function -- high-level syntax and low-level syntax. The behavior of the patch
function differs somewhat depending on which syntax you use.
High-Level Syntax
When you use the high-level syntax, MATLAB automatically determines how to color each face based on the color data you specify. The high-level syntax enables you to omit the property names for the x-, y-, and z-coordinates and the color data, as long as you specify these arguments in the correct order.
However, you must specify color data so MATLAB can determine what type of coloring to use. If you do not specify color data, MATLAB returns an error.
Low-Level Syntax
The low-level syntax accepts only property name/property value pairs as arguments and does not automatically color the faces unless you also change the value of the FaceColor
property. For example, the statement
draws a patch with white face color because the factory default value for the FaceColor
property is the color white.
See the list of patch properties in the MATLAB Function Reference and the get
command for information on how to obtain the factory and user default values for properties.
Interpreting the Color Argument
When you use the low-level syntax, MATLAB interprets the third (or fourth if there are z-coordinates) argument as color data. If you intend to define a patch with x-, y-, and z-coordinates, but leave out the color, MATLAB interprets the z-coordinates as color data, and then draws a 2-D patch. For example,
draws a patch with all vertices at z = 0, colored by interpolating the vertex colors (since there is one color for each vertex), whereas
draws a patch with vertices at increasing values of z, colored yellow.
Specifying Patch Coloring provides more information on options for coloring patches.
Introduction to Patch Objects | Creating a Single Polygon |
© 1994-2005 The MathWorks, Inc.