11.07.2015 Views

Advanced Programming Guide

Advanced Programming Guide

Advanced Programming Guide

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

232 • Chapter 6: <strong>Programming</strong> with Maple Graphics∞∑ (−1) kk=1k= −ln(2)For more information on the PLOT data structure, see the ?plot,structurehelp page.The PLOT3D Data StructureThe three-dimensional plotting data structure has a form similar to thePLOT data structure. The following Maple expression generates a threedimensionalplot of three lines and axes of type frame.> PLOT3D( CURVES( [ [3, 3, 0], [0, 3, 1],> [3, 0, 1], [3, 3, 0] ] ),> AXESSTYLE(FRAME) );10.80.60.40.200.51 1.5 22.53322.511.500.5The following procedure creates the yellow sides of a box.> yellowsides := proc(x, y, z, u)> # (x,y,0) = coordinates of a corner.> # z = height of box> # u = side length of box> POLYGONS(> [ [x,y,0], [x+u,y,0], [x+u,y,z], [x,y,z] ],> [ [x,y,0], [x,y+u,0], [x,y+u,z], [x,y,z] ],> [ [x+u, y,0], [x+u,y+u,0], [x+u,y+u,z], [x+u,y,z] ],> [ [x+u, y+u,0], [x,y+u,0], [x,y+u,z], [x+u,y+u,z] ],> COLOR(RGB,1,1,0) );> end proc:The redtop procedure generates a red lid for the box.> redtop := proc(x, y, z, u)> # (x,y,z) = coordinates of a corner.> # u = side length of square> POLYGONS( [ [x,y,z], [x+u,y,z], [x+u,y+u,z], [x,y+u,z] ],> COLOR(RGB, 1, 0, 0) );

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

Saved successfully!

Ooh no, something went wrong!