實驗六

restart;

with(plottools):

with(plots):

p1:=sphere([0,0,0],1):

p2:=polygon([[-1,1,1],[1,-1,1],[1,1,-1]]):

p3:=polygon([[-1,-1,-1],[1,-1,1],[1,1,-1]]):

p4:=polygon([[-1,1,1],[-1,-1,-1],[1,1,-1]]):

p5:=polygon([[-1,1,1],[1,-1,1],[-1,-1,-1]]):

display(p1,p2,p3,p4,p5);

 

restart;

with(linalg):

with(plots):

with(plottools):

p:=expand((1-u)*[-1,1,1]+u*[0,0,1]):

p1:=expand(p-[1/3,1/3,1/3]):

q:=expand([1/3,1/3,1/3]+sqrt(6)/3*p1/(norm(p1,2))):

r:=expand((1-t)*q+t*p):

s:=expand(r/norm(r,2)):

q1:=plot3d(s,u=0..1,t=0..1,scaling=constrained,style=patchnogrid):

q2:=reflect(q1,[[0,0,0],[1,1,1],[-1,1,1]]):

r1:=display(q1,q2):

r2:=rotate(r1,2*Pi/3,[[0,0,0],[1,1,1]]):

r3:=rotate(r1,4*Pi/3,[[0,0,0],[1,1,1]]):

s1:=display(r1,r2,r3):

s2:=reflect(s1,[[0,0,0],[-1,1,1],[1,-1,1]]):

s3:=reflect(s1,[[0,0,0],[-1,1,1],[1,1,-1]]):

s4:=reflect(s1,[[0,0,0],[1,1,-1],[1,-1,1]]):

display(s1,s2,s3,s4);

 

restart;

with(plots):

with(geom3d):

cube(c,point(o,0,0,0),sqrt(3));

sphere(s,[point(o,0,0,0),sqrt(2)]);

p1:=display(draw(c),color=green):

p2:=display(draw(s),color=red):

display(p1,p2);

 

restart;

p:=expand((1-u)*[cos(t),sin(t),1]+u*[1,sin(t),1]);

with(linalg):

q:=expand(sqrt(2)*p/norm(p,2));

r1:=plot3d(q,t=0..Pi/2,u=0..1,style=patchnogrid):

with(plots):

with(plottools):

r2:=rotate(r1,2*Pi/3,[[0,0,0],[1,1,1]]):

r3:=rotate(r1,4*Pi/3,[[0,0,0],[1,1,1]]):

u1:=display(r1,r2,r3):

u2:=rotate(u1,0,0,Pi/2):

u3:=rotate(u1,0,0,Pi):

u4:=rotate(u1,0,0,3*Pi/2):

v1:=display(u1,u2,u3,u4,scaling=constrained):

v2:=reflect(v1,[0,0,0]):

display(v1,v2);

 

restart;

with(plots):

with(plottools):

p1:=plot3d(1,theta=0..2*Pi,phi=0..Pi/4,coords=spherical,scaling=constrained):

q1:=translate(p1,0,0,-sqrt(2)):

q2:=rotate(q1,0,Pi/2,0):

q3:=rotate(q1,0,Pi,0):

q4:=rotate(q1,0,3*Pi/2,0):

q5:=rotate(q1,Pi/2,0,0):

q6:=rotate(q1,3*Pi/2,0,0):

display(q1,q2,q3,q4,q5,q6);