CSE 477, G. Farin

Cubic Bezier Subdivision

The de Casteljau algorithm creates control polygons for the curve segments “left” and “right”  of the evaluation point.
Thus, for the cubic case:

	(Subscript[b, 0]^0)
	(Subscript[b, 1]^0)    (Subscript[b, 0]^1)
	(Subscript[b, 2]^0)    (Subscript[b, 1]^1)    (Subscript[b, 0]^2)
	(Subscript[b, 3]^0)    (Subscript[b, 2]^1)    (Subscript[b, 1]^2)    (Subscript[b, 0]^3)  
  
  the bottom row holds control points for the right segment, and the diagonal holds those for the left one.

dca[b_,r_,i_,t_]:=If [r==0,b[[i+1]],(1-t)*dca[b,r-1,i,t]+t*dca[b,r-1,i+1,t]];


b={{-1,0,0},{0,-1,0},{1,1,0},{1,1,1}}; 
n=Length[b]-1;

curve=ParametricPlot3D[dca[b,n,0,t],{t,0,1},PlotStyle->{Thick}]; (* try different t-limits *)
poly=Graphics3D[{Thick,Green,Line[b]}];

points=Graphics3D[{PointSize[Large],Point[b]}];
begin= Graphics3D[{PointSize[Large],Red,Point[b[[1]]]}];

Dynamic Subdivision

Manipulate[
polyright[b_,t_]:=Table[dca[b,i,n-i,t],{i,0,n}];
polyleft[b_,t_]:=Table[dca[b,i,0,t],{i,0,n}];
plotright[t_]:=Graphics3D[{Blue,Thick,Line[polyright[b,t]]}];
plotleft[t_]:=Graphics3D[{Red,Thick,Line[polyleft[b,t]]}];
pointsright[t_]:=Graphics3D[{PointSize[Large],Point[polyright[b,t]]}];
pointsleft[t_]:=Graphics3D[{PointSize[Large],Point[polyleft[b,t]]}];


Show[{poly,curve,points,plotright[t],plotleft[t],pointsleft[t],pointsright[t]},Boxed->False,Axes->False,PlotRange->1],
{t,0,1}]