Drawing cubes with Maple
The following commands load in some useful packages.
> | with(plots): with(plottools): |
Warning, the name changecoords has been redefined
Warning, the name arrow has been redefined
Define the coordinates of the eight vertices.
> | p1:=[0,0,0]; p2:=[1,0,0]; p3:=[0,1,0]; p4:=[1,1,0]; p5:=[0,0,1]; p6:=[1,0,1]; p7:=[0,1,1]; p8:=[1,1,1]; |
Define a cube by giving the vertices for each square face, in the order that they appear around the square.
> | c:=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]]): |
Define seven copies of the cube by translating it in various ways. Give the cubes color, if you wish.
> | c1:=display(translate(c,0,0,0),color=yellow): c2:=display(translate(c,-1,0,0),color=pink): c3:=display(translate(c,-2,0,0),color=pink): c4:=display(translate(c,0,1,0),color=green): c5:=display(translate(c,0,2,0),color=green): c6:=display(translate(c,0,3,0),color=green): c7:=display(translate(c,0,0,1),color=white): |
Display the result. You can click and drag it to turn it around and view it from different directions.
> | display([c1,c2,c3,c4,c5,c6,c7],scaling=constrained); |
> |