CSE 477 / G. Farin
Bicubic Bezier  surfaces

We show some bicubic Bezier surfaces, using the Mathematica BSplineSurface function. This good for Graphics display, but it does not allow us to compute with these surfaces.

(* a control mesh: *)
bb=Table[{i,j,-i^2/5+i-Sin[2j]},{i,4},{j,4}];

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[{surfplot,netplot},Boxed->False,ViewPoint->{-6,-14,17},PlotRange-> 0.3radius]),{{z22, init22},-5,5},{{z21,init21},-5,5}]

In the next cell, we compute Bezier surfaces together with their “midpoint.”

(* a control mesh: *)
bb=Table[{i,j,-i^2/5+i-Sin[2j]},{i,4},{j,4}];

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];

surf[u_,v_]:= Sum[Sum[bb[[i,j]]*BernsteinBasis[3,i-1,u]*BernsteinBasis[3,j-1,v],{i,4}],{j,4}];


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]];(* This runs faster than using surf[u,v] *)
midpoint=surf[0.5,0.5];
pointplot=Graphics3D[{PointSize[0.03],Green,Point[midpoint]}];

Show[{surfplot,(*netplot,*) pointplot},Boxed->False,ViewPoint->{-6,-14,17},PlotRange-> 0.3radius]),{{z22, init22},-5,5},{{z21,init21},-5,5}]

Next,a moving isoparametric curve.

(* a control mesh: *)
bb=Table[{2i,j,-i^2/5+i+i*Sin[4j]},{i,4},{j,4}];

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];

surf[u_,v_]:= Sum[Sum[bb[[i,j]]*BernsteinBasis[3,i-1,u]*BernsteinBasis[3,j-1,v],{i,4}],{j,4}];

Manipulate[(
netplot=Graphics3D[{PointSize[Large],Red,Map[Point,bb],Gray,Line[bb],Line[Transpose[bb]]}];
surfplot=Graphics3D[BSplineSurface[bb]];
curve[t_]:=surf[s,t]; (* try playing with surf[t,s] instead *)
curvplot=ParametricPlot3D[curve[u],{u,0,1},PlotStyle->{Thickness[0.01],Green}];
Show[{(*netplot,*)surfplot, curvplot},Boxed->False,ViewPoint->{-6,-14,17},PlotRange-> 0.3radius]),{s,0,1}]