Using Maple to display a cube

Load in some useful commands.

> with(plots): with(plottools):

Warning, the name arrow has been redefined

Warning, the name arrow has been redefined

Define the eight vertices (corners). Ending each statement with a semicolon causes the computer to show the results.

> p1:=[-1,-1,-1]; p2:=[-1,-1,1]; p3:=[-1,1,-1]; p4:=[-1,1,1]; p5:=[1,-1,-1]; p6:=[1,-1,1]; p7:=[1,1,-1]; p8:=[1,1,1];

p1 := [-1, -1, -1]

p2 := [-1, -1, 1]

p3 := [-1, 1, -1]

p4 := [-1, 1, 1]

p5 := [1, -1, -1]

p6 := [1, -1, 1]

p7 := [1, 1, -1]

p8 := [1, 1, 1]

Define the cube in terms of its polygons. For each polygon list the vertices in the proper order around its perimeter. It helps if you first make a sketch on a piece of paper. Ending the statement with a colon prevents the computer from showing the results.

> cube:=polygonplot3d([ [p1,p2,p4,p3], [p5,p6,p8,p7], [p1,p2,p6,p5], [p3,p4,p8,p7], [p1,p3,p7,p5], [p2,p4,p8,p6] ]):

Give the cube its color.

> yellowcube:=display(cube,color=yellow):

Display it. You can twirl it around by clicking and dragging. Here we want a semicolon so that we can see it!

> display(yellowcube,scaling=constrained);

[Maple Plot]

Make a new cube by adding (1,-1,1) to every point of the first cube (i.e., translating it).

> orangecube:=display(translate(cube,1,-1,1),color=orange):

Display both cubes.

> display({yellowcube,orangecube},scaling=constrained);

[Maple Plot]