3-D Visualization Previous page   Next Page

Creating a Single Polygon

A polygon is simply a patch with one face. To create a polygon, specify the coordinates of the vertices and color data with a statement of the form

For example, these statements display a 10-sided polygon with a yellow face enclosed by a black edge. The axis equal command produces a correctly proportioned polygon.

The first and last vertices need not coincide; MATLAB automatically closes each polygonal face of the patch. In fact, it is generally better to define each vertex only once, particularly if you are using interpolated face coloring.

Interpolated Face Colors

You can control many aspects of the patch coloring. For example, instead of specifying a single color, you can provide a range of numerical values that map the color at each vertex to a color in the figure colormap.

MATLAB now interpolates the colors across the face of the patch. You can color the edges of the patch the same way, by setting the edge colors to be interpolated. The command is

Specifying Patch Coloring provides more information on options for coloring patches.


Previous page  Behavior of the patch Function Multifaceted Patches Next page

© 1994-2005 The MathWorks, Inc.