CSE 477 / G. Farin

Rational Bezier cubics

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,1,0},{0,0,1},{1,0,-1},{2,2,0}};
w1=5;
w2=2;
w={1.0,w1,w2,1.0}; (* weights *)

rb=Table[w[[i]]*b[[i]], {i,1,4}];

Plotting the weight function w (t)

wt=Plot[dca[w,3,0,t],{t,-.5,1.5},PlotStyle->{Thick, Gray},AxesOrigin-> {0,0},PlotRange->6];
wpol=Graphics[Line[{{0,1},{1/3,w1},{2/3,w2},{1,1}}]];
wpt=Graphics[{PointSize[Large],Red,Point[ {{0,1},{1/3,w1},{2/3,w2},{1,1}}  ]}];
Show[{wt,wpol,wpt}]

Plotting the curve

curve=ParametricPlot3D[dca[rb,3,0,t]/dca[{1,w1,w2,1},3,0,t],{t,0,1},PlotStyle->{Thick, Green},PlotRange->2];
poly=Graphics3D[{Thick,Line[b]}];
points=Graphics3D[{PointSize[Large],Red,Point[b]}];
Show[{points,curve,poly}]

Visualizing the curve parametrization

cpoints=Graphics3D[{Thick,Green,PointSize[Large],Point[Table[dca[rb,3,0,t]/dca[{1,w1,w2,1},3,0,t],{t,0,1,0.03}]],PlotRange->3}];
Show[{points,poly,cpoints}]

Effect of the weights

Manipulate[
curve=ParametricPlot3D[dca[{b[[1]],w1*b[[2]],w2*b[[3]],b[[4]]},3,0,t]/dca[{1,w1,w2,1},3,0,t],{t,0,1},PlotStyle->{Thick, Green},PlotRange->2];
poly=Graphics3D[{Thick,Line[b]}];
points=Graphics3D[{PointSize[Large],Red,Point[b]}];
Show[{points,poly,curve}],{{w1,1},0,5},{{w2,1},0,5}]

Motion along rays

Manipulate[
curve=ParametricPlot3D[dca[{b[[1]],w1*b[[2]],w2*b[[3]],b[[4]]},3,0,t]/dca[{1,w1,w2,1},3,0,t],{t,0,1},PlotStyle->{Thick, Green},PlotRange->2];
crays1=Graphics3D[{Gray,Line[Table[{dca[{b[[1]],w1*b[[2]],w2*b[[3]],b[[4]]},3,0,t]/dca[{1,w1,w2,1},3,0,t],  b[[2]] },{t,0,1,0.03}]],PlotRange->3}];
crays2=Graphics3D[{Gray,Line[Table[{dca[{b[[1]],w1*b[[2]],w2*b[[3]],b[[4]]},3,0,t]/dca[{1,w1,w2,1},3,0,t],  b[[3]] },{t,0,1,0.03}]],PlotRange->3}];

poly=Graphics3D[{Thick,Line[b]}];
points=Graphics3D[{PointSize[Large],Red,Point[b]}];
Show[{points,poly,curve,crays1,crays2}],{{w1,1},-1,5},{{w2,1},-1,5}]