CSE 477, G. Farin
Quiz 1 Bezier torus
self-graded

Create a rectilinear array of data points (Subscript[p, ij]), read off from a part of a torus.

 Build a 4x4 “rectangular” array of points 
on the torus and sketch the bicubic Bezier surface defined by that control mesh. 

Then repeat for a biquqadratic.

(*  control mesh: *)
bb={{{0,2,0},{2,2.2,0},{3,1.2,0},{3,0,0}},
{{0,2,1},{2,2.2,1},{3,1.2,1},{3,0,1}},
{{0,3,1},{3,3,1},{4,2,1},{4,0,1}},
{{0,3,0},{3,3,0},{4,2.2,0},{4,0,0}}};

center=Sum[Sum[bb[[i,j]],{i,4}],{j,4}]/16;
Do[bb[[i,j]]=bb[[i,j]]-center,{i,4},{j,4}];
dists=Table[Norm[bb[[i,j]]-center],{i,4},{j,4}];
radius=Max[dists];

init22=bb[[2,2]][[3]];
init21=bb[[2,1]][[3]];
Manipulate[(
bb[[2,2]][[3]]=z22;
bb[[2,1]][[3]]=z21;
netplot=Graphics3D[{PointSize[Large],Red,Map[Point,bb],Gray,Line[bb],Line[Transpose[bb]]}];
surfplot=Graphics3D[BSplineSurface[bb]];
Show[{netplot,surfplot},Boxed->False,ViewPoint->{-6,-14,17},PlotRange-> All]),{{z22, init22},-5,5},{{z21,init21},-5,5}]