ROV17_6.MWS

Part 3. Polyhedra with MAPLE.

Chapter 17. Regular Polyhedra

Rovenski Vladimir, Haifa

> restart:

17.1 What Is a Polyhedron

Example 1 . Let us plot with Maple a plane triangle

> plots[polygonplot]([[0,0],[2,4],[5,3]], color=green); # triangle in the plane

[Maple Plot]

> n:=6: a:=i->[cos(2*Pi*i/n),sin(2*Pi*i/n)]; # hexagon

[Maple Math]

> plots[polygonplot]([seq(a(i), i=1..n)],scaling=constrained); # First method

[Maple Plot]

> p1:=plot([seq(a(i), i=1..n+1)], thickness=2): p2:=plot([cos(t),sin(t), t=0..2*Pi], linestyle=2): plots[display]({p1,p2},scaling=constrained); # circle and n-gon

[Maple Plot]

Plot a regular pyramid and a prism of height 2.

> n:=6: # pyramid with vertex S(0,0,2)

> a:=i -> [cos(2*Pi*i/n),sin(2*Pi*i/n),0]: for i from 1 to n do g[i]:=[a(i),a(i+1),[0,0,2]] od: g[n+1]:=[seq(a(i), i=1..n)];

[Maple Math]

> P:=j -> plots[polygonplot3d]([seq(g[i], i=1..n+1)],orientation=[20*j,50], style=PATCH):

> plots[display]([seq(P(j), j=1..18)], insequence=true,scaling=constrained);

[Maple Plot]

> n:=6: # prism with vertical edge [0,0,2]

> a:=i -> [cos(2*Pi*i/n), sin(2*Pi*i/n), 0]:for i from 1 to n do g[i]:=[a(i),a(i+1),a(i+1)+[0,0,2],a(i)+[0,0,2]] od: g[n+1]:=[seq(a(i), i=1..n)]:g[n+2]:=[seq(a(i)+[0,0,2], i=1..n)]:

> P:=j -> plots[polygonplot3d]([seq(g[i], i=1..n+2)], orientation=[20*j,40], style=PATCH):

> plots[display]([seq(P(j), j=1..18)], insequence=true,scaling=constrained);

[Maple Plot]

For plotting the pyramid and the prism without rotation one can use the command (instead of last two commands).

> plots[polygonplot3d]([seq(g[i], i=1..n+2)], style=PATCH,scaling=constrained);

[Maple Plot]

17.2 Platonic Solids

Example 1 . Maple has special commands for plotting Platonic solids ; see the program below.

> restart: with(plottools):

> f1:=hexahedron([0,0,0],.8): plots[display](f, style=patch, scaling=constrained);

[Maple Plot]

> f2:=tetrahedron([0,0,0],.8): plots[display](f, scaling=constrained);

[Maple Plot]

> f3:=octahedron([0,0,0],.8): plots[display](f, scaling=constrained);

[Maple Plot]

> f4:=icosahedron([0,0,0],.8): plots[display](f, scaling=constrained);

[Maple Plot]

> f5 := dodecahedron([0,0,0],0.8): plots[display](f,scaling=constrained);

[Maple Plot]

Each of these polyhedra can be rotated using the commands

> P:=i-> plots[display](f1, style=patch, orientation=[10*i,50],light=[75,75, 1,.9,.2], ambientlight=[.7, .7, .8]): plots[display]([seq(P(i), i=1..36)], insequence=true,scaling=constrained);

[Maple Plot]

> P:=i-> plots[display](f2, style=patch, orientation=[10*i,50],light=[75,75, 1,.9,.2], ambientlight=[.7, .7, .8]): plots[display]([seq(P(i), i=1..36)], insequence=true,scaling=constrained);

[Maple Plot]

> P:=i-> plots[display](f3, style=patch, orientation=[10*i,50],light=[75,75, 1,.9,.2], ambientlight=[.7, .7, .8]): plots[display]([seq(P(i), i=1..36)], insequence=true,scaling=constrained);

[Maple Plot]

> P:=i-> plots[display](f4, style=patch, orientation=[10*i,50],light=[75,75, 1,.9,.2], ambientlight=[.7, .7, .8]): plots[display]([seq(P(i), i=1..36)], insequence=true,scaling=constrained);

[Maple Plot]

> P:=i-> plots[display](f5, style=patch, orientation=[10*i,50],light=[75,75, 1,.9,.2], ambientlight=[.7, .7, .8]): plots[display]([seq(P(i), i=1..36)], insequence=true,scaling=constrained);

[Maple Plot]

The Platonic solids can be constructed using the cube.

Example 2 . P lot the image of a cube, tetrahedron, and octahedron using the coordinates of their vertices .

> restart: # hexahedron

> h||1:=[[-1,-1,-1],[1,-1,-1],[1,-1,1],[-1,-1,1]]: h||2:=[[1,1,-1],[-1,1,-1],[-1,1,1],[1,1,1]]: h||3:=[[-1,-1,-1],[1,-1,-1],[1,1,-1],[-1,1,-1]]: h||4:=[[-1,-1,1],[1,-1,1],[1,1,1],[-1,1,1]]: h||5:=[[1,-1,-1],[1,1,-1],[1,1,1],[1,-1,1]]: h||6:=[[-1,-1,-1],[-1,1,-1],[-1,1,1],[-1,-1,1]]:

> P:=j -> plots[polygonplot3d]([seq(h||i, i=1..6)], orientation=[20*j, 50], style=PATCH):

> plots[display]([seq(P(j), j=1..18)], insequence=true,scaling=constrained);

[Maple Plot]

> restart: # tetrahedron, dual tetrahedrons

> t1:=[[1,1,-1],[1,-1,1],[-1,1,1]]: t2:=[[1,1,-1],[1,-1,1],[-1,-1,-1]]: t3:=[[-1,-1,-1],[1,1,-1],[-1,1,1]]: t4:=[[-1,-1,-1],[1,-1,1],[-1,1,1]]:

> plots[polygonplot3d]({-t1,-t2,-t3,-t4},scaling=constrained); # tetrahedron,

[Maple Plot]

> P:=j->plots[polygonplot3d]([t1,t2,t3,t4,-t1,-t2,-t3,-t4],orientation=[20*j,50], style=PATCH):

> plots[display]([seq(P(j), j=1..18)], insequence=true,scaling=constrained);

[Maple Plot]

# octahedron,

> restart: g[1]:=[[1,1,0],[-1,1,0],[0,0,1]]: g[2]:=[[1,1,0],[1,-1,0],[0,0,1]]: g[3]:=[[-1,-1,0],[1,-1,0],[0,0,1]]: g[4]:=[[-1,-1,0],[-1,1,0],[0,0,1]]: g[5]:=[[1,1,0],[-1,1,0],[0,0,-1]]: g[6]:=[[1,1,0],[1,-1,0],[0,0,-1]]: g[7]:=[[-1,-1,0],[1,-1,0],[0,0,-1]]: g[8]:=[[-1,-1,0],[-1,1,0],[0,0,1]]:

> P:=j -> plots[polygonplot3d]([seq(g[i], i=1..8)],orientation=[20*j, 50], style=PATCH):

> plots[display]([seq(P(j), j=1..18)], insequence=true,scaling=constrained);

[Maple Plot]

Example 3 . Icosahedron and dodecahedron

> restart: c:=1: p:=evalf(c*(sqrt(5)-1)/2): # icosahedron

> g[1]:=[[p,0,c],[-p,0,c],[0,c,p]]: g[2]:=[[p,0,c],[-p,0,c],[0,-c,p]]: g[3]:=[[-p,0,c],[0,c,p],[-c,p,0]]: g[4]:=[[-p,0,c],[-c,p,0],[-c,-p,0]]: g[5]:=[[p,0,c],[c,p,0],[0,c,p]]: g[6]:=[[p,0,c],[c,-p,0],[c,p,0]]: g[7]:=[[c,p,0],[c,-p,0],[p,0,-c]]: g[8]:=[[c,p,0],[0,c,-p],[0,c,p]]: g[9]:=[[c,p,0],[0,c,-p],[p,0,-c]]: g[10]:=[[0,c,p],[0,c,-p],[-c,p,0]]: g[11]:=[[0,c,-p],[-c,p,0],[0,c,p]]: g[12]:=[[p,0,-c],[-p,0,-c],[0,c,-p]]: g[13]:=[[p,0,c],[c,-p,0],[0,-c,p]]: g[14]:=[[0,-c,p],[-p,0,c],[-c,-p,0]]: g[15]:=[[0,-c,p],[0,-c,-p],[-c,-p,0]]: g[16]:=[[p,0,-c],[-p,0,-c],[0,-c,-p]]: g[17]:=[[0,-c,-p],[-p,0,-c],[-c,-p,0]]: g[18]:=[[-p,0,-c],[-c,p,0],[-c,-p,0]]: g[19]:=[[c,-p,0],[0,-c,-p],[p,0,-c]]: g[20]:=([[0,-c,p],[0,-c,-p],[c,-p,0]]):

> P:=j -> plots[polygonplot3d]([seq(g[i], i=1..20)],orientation=[20*j,50], style=PATCH):

> plots[display]([seq(P(j), j=1..18)], insequence=true,scaling=constrained);

[Maple Plot]

> restart: c:=1: p:=evalf(c*(sqrt(5)-1)/2): # dodecahedron,

> a[1]:=[p,0,c+p]: a[2]:=[-p,0,c+p]: a[3]:=[p,0,-c-p]: a[4]:=[-p,0,-c-p]: a[5]:=[c+p,-p,0]: a[6]:=[c+p,p,0]: a[7]:=[-c-p,-p,0]: a[8]:=[-c-p,p,0]: a[9]:=[0,c+p,p]: a[10]:=[0,c+p,-p]: a[11]:=[0,-c-p,p]: a[12]:=[0,-c-p,-p]: a[13]:=[c,c,c]: a[14]:=[c,c,-c]: a[15]:=[c,-c,c]: a[16]:=[c,-c,-c]: a[17]:=[-c,c,c]: a[18]:=[-c,c,-c]: a[19]:=[-c,-c,c]: a[20]:=[-c,-c,-c]:

> g[1]:=[a[2],a[17],a[8],a[7],a[19]]: g[2]:=[a[1],a[13],a[9],a[17],a[2]]: g[3]:=[a[17],a[9],a[10],a[18],a[8]]: g[4]:=[a[8],a[18],a[4],a[20],a[7]]: g[5]:=[a[7],a[20],a[12],a[11],a[19]]: g[6]:=[a[19],a[11],a[15],a[1],a[2]]: g[7]:=[a[6],a[5],a[15],a[1],a[13]]: g[8]:=[a[6],a[13],a[9],a[10],a[14]]: g[9]:=[a[14],a[10],a[18],a[4],a[3]]: g[10]:=[a[3],a[4],a[20],a[12],a[16]]: g[11]:=[a[16],a[12],a[11],a[15],a[5]]: g[12]:=[a[5],a[6],a[14],a[3],a[16]]:

> P:=j -> plots[polygonplot3d]([seq(g[i], i=1..12)],orientation=[20*j,50], style=PATCH):

> plots[display]([seq(P(j), j=1..18)], insequence=true,scaling=constrained);

[Maple Plot]

>

17.3 Star-Shaped Polyhedra

Example 1 . P lot a regular star polygon (inscribed in a circle) using the program for a simple regular polygon.

> n:=5: m:=2: # star pentagon, 2 methods

> a:=i -> [cos(2*Pi*i*m/n), sin(2*Pi*i*m/n)]:

> plots[polygonplot]([seq(a(i), i=1..n)], scaling=constrained,axes=framed); # First method

[Maple Plot]

>

> p1:=plot([cos(t),sin(t), t=0..2*Pi]): p2:=plot([seq(a(i), i=1..n+1)],thickness=2): plots[display]({p1, p2}, scaling=constrained); # second method

[Maple Plot]

>

Plot five star-shaped polyhedra (SPs) over Platonic solids using stellate (stellar meaning starlike)

> with(plottools): with(plots):

Warning, existing definition for changecoords has been overwritten

> f[1]:=display(stellate(tetrahedron(),5), scaling=constrained): %;

[Maple Plot]

> f[2]:=display(stellate(hexahedron(),3), scaling=constrained): %;

[Maple Plot]

> f[3]:=display(stellate(octahedron(),2), scaling=constrained): %;

[Maple Plot]

> f[4]:=display(stellate(icosahedron(),2), scaling=constrained): %;

[Maple Plot]

> f[5]:=display(stellate(dodecahedron(),2), scaling=constrained): %;

[Maple Plot]

>

Each of these polyhedra f can be rotated, for example, using the commands

> P:=i->display(f[5], style=patch, orientation=[10*i,50],light=[75,75, 1,.9,.2], ambientlight=[.7, .7, .8]):

> plots[display]([seq(P(i),i=1..36)],insequence=true,scaling=constrained);

[Maple Plot]

Example 2 . Use polygons to plot a Christmas tree. Generalize this program to the three-dimensional case.

> toy1:=proc(x,y,R) local P; P||1:=plot([[x,y],[x,y-.3]]); P||2:=plottools[circle]([x,y-.3-R],R,color=blue,thickness =2); plots[display]([P||1,P||2],scaling=constrained) end:

> toy2:=proc(x,y,n,R) local P; P||1:=plot([[x,y],[x,y-.3]]); P||2:=plot([seq([x+R*sin(2*Pi*i/n), y+R*cos(2*Pi*i/n)-0.3-R], i=0..n)], thickness=2,axes=none): P||3:=plottools[circle]([x,y-.5],.2,color=green,thickness=2); plots[display]([P||1,P||2],scaling=constrained) end:

> # ...

> star:=proc(x,y,n,m,R) local i,a; for i from 0 to n+1 do a[i]:=[x+R*cos(2*Pi*i*m/n),y+R*sin(2*Pi*i*m/n)] od: plot([seq(a[i],i=0..n)], thickness=2, color=red) end:

> tree:=proc() local S,Q,L,M,k,i,t,s; k:=4; s:=8; for i from 1 to s do t[i]:=4-i; S[i]:=plot([[0,t[i]],[k,t[i]-2]],color=green); Q[i]:=plot([[k,t[i]-2],[0,t[i]-1]],color=green); L[i]:=plot([[0,t[i]],[-k,t[i]-2]],color=green); M[i]:=plot([[-k,t[i]-2],[0,t[i]-1]],color=green) od; plots[display]([seq(S[i],i=1..s),seq(Q[i],i=1..s),seq(L[i],i=1..s),seq(M[i],i=1..s)],thickness=3) end:

> y:=-4.3: d:=.25: box:=plot([[-d,y],[d,y],[d,y-2],[-d,y-2],[-d,y]], thickness=2,color=brown):

# Christmas tree

> k:=4: plots[display](star(0,3.4,7,2,.3),box,tree(), seq([toy1(k+.1,2-i,.2), toy1(-k-.1,2-i,.2)],i=1..7), seq([toy2(evalf(k/2+(-1)^i/2),2-i,3,.2), toy2(evalf(-k/2+(-1)^i/2),2-i,4,.2)],i=1..6)); # Christmas tree

[Maple Plot]

>

Example 3 . Let us plot regular star dodecahedra

> restart: with(plottools): # large dodecahedron (star forms of dodecahedron)

> c:=1: p:=evalf(c*(sqrt(5)-1)/2): k:=evalf(1+2*cos(Pi/5)):

> a[1]:=[p,0,c+p]: a[2]:=[-p,0,c+p]: a[3]:=[p,0,-c-p]: a[4]:=[-p,0,-c-p]: a[5]:=[c+p,-p,0]: a[6]:=[c+p,p,0]: a[7]:=[-c-p,-p,0]: a[8]:=[-c-p,p,0]: a[9]:=[0,c+p,p]: a[10]:=[0,c+p,-p]: a[11]:=[0,-c-p,p]: a[12]:=[0,-c-p,-p]: a[13]:=[c,c,c]: a[14]:=[c,c,-c]: a[15]:=[c,-c,c]: a[16]:=[c,-c,-c]: a[17]:=[-c,c,c]: a[18]:=[-c,c,-c]: a[19]:=[-c,-c,c]:a[20]:=[-c,-c,-c]: # see the program for the dodecahedron

> g[1]:=[a[2],a[17],a[8],a[7],a[19]]: g[2]:=[a[1],a[13],a[9],a[17],a[2]]: g[3]:=[a[17],a[9],a[10],a[18],a[8]]: g[4]:=[a[8],a[18],a[4],a[20],a[7]]: g[5]:=[a[7],a[20],a[12],a[11],a[19]]: g[6]:=[a[19],a[11],a[15],a[1],a[2]]: g[7]:=[a[6],a[5],a[15],a[1],a[13]]: g[8]:=[a[6],a[13],a[9],a[10],a[14]]: g[9]:=[a[14],a[10],a[18],a[4],a[3]]: g[10]:=[a[3],a[4],a[20],a[12],a[16]]: g[11]:=[a[16],a[12],a[11],a[15],a[5]]: g[12]:=[a[5],a[6],a[14],a[3],a[16]]: # see the program for the dodecahedron

> for i from 1 to 12 do c[i]:=(sum('g[i][j]','j'=1..5)/5): p[i]:=[seq((c[i]-k*(g[i][j]-c[i])), j=1..5)] od:

> P:=j -> plots[polygonplot3d]([seq(p[i], i=1..12)],orientation=[20*j,50], style=PATCH, lightmodel=light2):

> plots[display]([seq(P(j), j=1..18)], insequence=true,scaling=constrained);

[Maple Plot]

# continuation: small star dodecahedron

> for i from 1 to 12 do b1[i]:=[op(1, g[i]), op(2,g[i]), op(4,p[i])]: b2[i]:=[op(2,g[i]), op(3,g[i]), op(5,p[i])]: b3[i]:=[op(3,g[i]), op(4,g[i]), op(1,p[i])]: b4[i]:=[op(4,g[i]), op(5,g[i]), op(2,p[i])]: b5[i]:=[op(5,g[i]), op(1,g[i]), op(3,p[i])] od:

> plots[polygonplot3d]({seq(b1[i],i=1..12), seq(b2[i],i=1..12), seq(b3[i],i=1..12), seq(b4[i],i=1..12), seq(b5[i],i=1..12)}, style=patch, lightmodel=light2, scaling=constrained);

[Maple Plot]

# continuation: large star dodecahedron, 3 methods

> for i from 1 to 12 do d1[i]:=[seq((c[i]-k*(b1[i][j]-c[i])), j=1..3)]: d2[i]:=[seq((c[i]-k*(b2[i][j]-c[i])), j=1..3)]: d3[i]:=[seq((c[i]-k*(b3[i][j]-c[i])), j=1..3)]: d4[i]:=[seq((c[i]-k*(b4[i][j]-c[i])), j=1..3)]: d5[i]:=[seq((c[i]-k*(b5[i][j]-c[i])), j=1..3)] od:

> plots[polygonplot3d]({seq(d1[i], i=1..12), seq(d2[i],i=1..12),seq(d3[i], i=1..12), seq(d4[i], i=1..12), seq(d5[i], i=1..12)}, style=patch, lightmodel=light2,scaling=constrained); # First method

[Maple Plot]

> plots[display](stellate(POLYGONS(seq(g[i],i=1..12)),2.3), style=patch, lightmodel=light2,scaling=constrained); # second method

[Maple Plot]

> plots[display](stellate(dodecahedron(),2.3),style=patch,lightmodel=light2, scaling=constrained); # third method

[Maple Plot]

>

Example 4 .

Plot the regular star icosahedron by using the coordinates of its vertices and their order in all the faces.

> c:=1: p:=evalf(c*(sqrt(5)-1)/2):

> g[1]:=[[p,0,c],[-p,0,c],[0,c,p]]: g[2]:=[[p,0,c],[-p,0,c],[0,-c,p]]: g[3]:=[[-p,0,c],[0,c,p],[-c,p,0]]: g[4]:=[[-p,0,c],[-c,p,0],[-c,-p,0]]: g[5]:=[[p,0,c],[c,p,0],[0,c,p]]: g[6]:=[[p,0,c],[c,-p,0],[c,p,0]]: g[7]:=[[c,p,0],[c,-p,0],[p,0,-c]]: g[8]:=[[c,p,0],[0,c,-p],[0,c,p]]: g[9]:=[[c,p,0],[0,c,-p],[p,0,-c]]: g[10]:=[[0,c,p],[0,c,-p],[-c,p,0]]: g[11]:=[[0,c,-p],[-c,p,0],[0,c,p]]: g[12]:=[[p,0,-c],[-p,0,-c],[0,c,-p]]: g[13]:=[[p,0,c],[c,-p,0],[0,-c,p]]: g[14]:=[[0,-c,p],[-p,0,c],[-c,-p,0]]: g[15]:=[[0,-c,p],[0,-c,-p],[-c,-p,0]]: g[16]:=[[p,0,-c],[-p,0,-c],[0,-c,-p]]: g[17]:=[[0,-c,-p],[-p,0,-c],[-c,-p,0]]: g[18]:=[[-p,0,-c],[-c,p,0],[-c,-p,0]]: g[19]:=[[c,-p,0],[0,-c,-p],[p,0,-c]]: g[20]:=([[0,-c,p],[0,-c,-p],[c,-p,0]]): # see the program for the icosahedron

> k:=evalf((3+sqrt(5))/(3-sqrt(5))): for i from 1 to 20 do c[i]:=(sum('g[i][j]','j' =1..3)/3): b[i]:=[seq((c[i]-k*(g[i][j]-c[i])), j=1..3)] od:

> P:=j -> plots[polygonplot3d]([seq(b[i], i=1..20)],orientation=[20*j,50], style=PATCH):

> plots[display]([seq(P(j), j=1..18)], insequence=true, scaling=constrained);

[Maple Plot]

>