teapot_body.mws          Spring 2001 

Data from Martin Newell  (Computer Graphics by Francis Hill,  p.656) 

The folowing is part of teapot body design without the sprout or the base attached. It should be sufficient however to illustrate how all these Bezier curves are used in three-dimensional surface design in an introductory course on computer graphics. 

> with(plots):
 

> b:=j-> binomial(3,j)*x^j*(1-x)^(3-j);
 

proc (j) options operator, arrow; binomial(3, j)*x^j*(1-x)^(3-j) end proc 

> p1:= [[1.4, 2.25],[1.3375, 2.38125], [1.4375, 2.38125], [1.5, 2.25]]:
 

> B1:= evalm(sum(b(j-1)*p1[j],j=1..4)):
 

> p2:= [[1.5, 2.25], [1.75,1.725], [2,1.2],[2, 0.75]]:
 

> B2:= evalm(sum(b(j-1)*p2[j],j=1..4)):
 

> p3:= [[2, 0.75], [2,0.3], [1.5, 0.075], [1.5,0]]:
 

> B3:= evalm(sum(b(j-1)*p3[j],j=1..4)):
 

>
 

> C1:= plot([B1[1], B1[2], x=0..1], color=green):
 

> C2:= plot([B2[1], B2[2], x=0..1], color=blue):
 

> C3:= plot([B3[1], B3[2], x=0..1], color= orange):
 

>
 

> pt1:= pointplot(p1, symbol=box, color=green):
 

> pt2:= pointplot(p2, symbol=box, color=blue):
 

> pt3:= pointplot(p3, symbol=box, color=orange):
 

> display({C1,C2,C3, pt1,pt2, pt3}, axes=boxed, scaling=constrained);
 

Plot 

We now rotate the curve about the vertical axis 

> tea1:= plot3d([B1[1]*cos(s),B1[1]*sin(s), B1[2]], x=0..1,s=0..2*Pi, color=green):
 

> tea2:= plot3d([B2[1]*cos(s),B2[1]*sin(s), B2[2]], x=0..1,s=0..2*Pi, color= blue):
 

> tea3:= plot3d([B3[1]*cos(s),B3[1]*sin(s), B3[2]], x=0..1,s=0..2*Pi, color= orange):
 

> display3d({tea1,tea2, tea3}, axes=boxed, style=patchnogrid, scaling=constrained);
 

Plot 

Lid desgin   Data from Hill's  p.669 

> q1:= [[0, 3], [0.8,3], [0, 2.7], [0.2, 2.55]];
 

[[0, 3], [.8, 3], [0, 2.7], [.2, 2.55]] 

> q2:= [[0.2,2.55], [0.4,2.4],[1.3,2.4], [1.3,2.25]];
 

[[.2, 2.55], [.4, 2.4], [1.3, 2.4], [1.3, 2.25]] 

> L1:= evalm(sum(b(j-1)*q1[j],j=1..4)):
 

> L2:= evalm(sum(b(j-1)*q2[j],j=1..4)):
 

> top1:= plot([L1[1],L1[2], x=0..1], color= brown):
 

> top2:= plot([L2[1],L2[2], x=0..1], color= black):
 

> display({top1,top2, C1,C2,C3},  scaling=constrained);
 

Plot 

> lid1:= plot3d([L1[1]*cos(s), L1[1]*sin(s), L1[2]], x=0..1, s=0..2*Pi, color = blue):
 

> lid2:= plot3d([L2[1]*cos(s), L2[1]*sin(s), L2[2]], x=0..1, s=0..2*Pi, color = yellow):
 

> display({lid1,lid2}, axes=boxed, scaling=constrained, style=patchnogrid);
 

Plot 

> display({lid1,lid2, tea1, tea2, tea3}, axes=boxed, scaling=constrained, style=patchnogrid);
 

Plot 

>
 

>