Download Maple Advanced Programming Guide

Transcript
272
•
Chapter 5: Programming with Maple Graphics
Note: The global STYLE(PATCH) and SCALING(CONSTRAINED) options
apply to the whole PLOT3D structure, except where the local
STYLE(PATCHNOGRID) option to the top and bottom of the gear overrides the global STYLE(PATCH) option.
Polygon Meshes
MESH data structures, described on page 265, are generated when you use
plot3d to draw parameterized surfaces. Example 4 converts a mesh of
points to the set of vertices for the corresponding polygon. By using polygons instead of a MESH structure, you can modify the individual polygons.
Example 4 The polygongrid procedure creates the vertices of a quadrangle at the (i, j)th grid value.
> polygongrid := proc(gridlist, i, j)
>
gridlist[j][i], gridlist[j][i+1],
>
gridlist[j+1][i+1], gridlist[j+1][i];
> end proc:
Use the makePolygongrid procedure to construct the appropriate
polygons.
> makePolygongrid := proc(gridlist)
>
local m,n,i,j;
>
n := nops(gridlist);
>
m := nops(gridlist[1]);
>
POLYGONS(seq(seq([polygongrid(gridlist, i, j)],
>
i=1..m-1), j=1..n-1));
> end proc:
The following is a mesh of points in 2-D space.
> L := [seq([seq([i-1, j-1], i=1..3)], j=1..4)];