B - Splines

(SetDirectory[ToFileName[Extract["FileName"/.NotebookInformation[EvaluationNotebook[]],{1},FrontEnd`FileName]]];)

dd={{0,0.5},{-1,0},{-2,1.5},{-1,3},{2,3},{2.2,1},{2.9,1},{3,3},{6,2},{7,1}};

Examples from CAGD book (Fig .8 .3)

knot={0,0,0,0,1,2,3,4,5,6,7,7,7,7};
Manipulate[(
knot={0,0,0,0,1,2,3,4,5,6,7,7,7,7};
dd={{0,0.5},{-1,0},{-2,1.5},{-1,3},{2,3},{2.2,1},{2.9,1},{3,3},{6,2},{7,1}};
center=Sum[dd[[i]],{i,1,10}]/10;
dists=Table[Norm[dd[[i]]-center],{i,1,10}];
radius=Max[dists];
 
Do[dd[[i]]=dd[[i]]-center,{i,1,10}];
(* This moves all points such that their centroid is the origin. *)

Do[dd[[i]]=dd[[i]]-center,{i,1,10}];
(* This moves all points such that their centroid is the origin. *)

curve = Graphics[{Red,Thick,BSplineCurve[pt,SplineKnots->knot,SplineDegree-> 3]}];
startcurve = Graphics[{Green,Thick,BSplineCurve[dd,SplineKnots->knot,SplineDegree-> 3]}];

polygon=Graphics[Line[pt]];
Show[{polygon,startcurve, curve},PlotRange->1.2radius]),{{pt,dd},Locator}
]

(*startcurve = Graphics[{Green,Thick,BSplineCurve[dd,SplineKnots->knot,SplineDegree-> 2]}];
*)
Manipulate[(
knot={0,0,0,1,2,3,4,5,6,7,8,8,8};
dd={{0,0.5},{-1,0},{-2,1.5},{-1,3},{2,3},{2.2,1},{2.9,1},{3,3},{6,2},{7,1}};
center=Sum[dd[[i]],{i,1,10}]/10;
dists=Table[Norm[dd[[i]]-center],{i,1,10}];
radius=Max[dists];
 
Do[dd[[i]]=dd[[i]]-center,{i,1,10}];
(* This moves all points such that their centroid is the origin. *)

Do[dd[[i]]=dd[[i]]-center,{i,1,10}];
(* This moves all points such that their centroid is the origin. *)

curve = Graphics[{Red,Thick,BSplineCurve[pt,SplineKnots->knot,SplineDegree-> 2]}];
startcurve = Graphics[{Green,Thick,BSplineCurve[dd,SplineKnots->knot,SplineDegree-> 2]}];

polygon=Graphics[Line[pt]];
Show[{polygon,startcurve, curve},PlotRange->1.2radius]),{{pt,dd},Locator}
]