I am trying to plot the B-Spline curve of degree 2 based on the B-Spline basis functions and curve's codes posted here How to speed up the plotting of B-spline curve? (Look at Trial 1 & Test 1). By definition, the interval should be {5, 8} that is from {5, 7} and {7, 8} for d = 2 and I would like to plot the curve. The details of my question are as follows:
knots = {2,4,5,7,8,10,11}
pts = {{1, 2}, {3, 5}, {6, 2}, {9, 4}};
I tried using the code given in the link but no graph appear. Anyone knows why?
knots = {2,4,5,7,8,10,11}
pts = {{1, 2}, {3, 5}, {6, 2}, {9, 4}};
BSplinePlot1[pts : {{_, _} ..}, knots_, opts : OptionsPattern[Plot]] :=
Module[{p = Length@First@Split[knots] - 1, a, b},
{a, b} = {First[knots], Last[knots]};
ParametricPlot[
Evaluate@
Simplify@
Total@
MapIndexed[
NBSpline[First@#2 - 1, p, knots, u] #1 &, pts], {u, a, b}, opts]
]
BSplinePlot1[pts, knots, ImageSize -> 600]
NBSpline
is left undefined. Do you have its definition in your notebook? $\endgroup$knots
is causing some trouble. What I mean is that if you tryknots = {0, 0, 0, 1/8, 2/8, 3/8, 1};
instead of your values you get a plot. Not sure why as I am not familiar with the code. And I am not sure if this is a helpful comment to be honest. I hope it is... $\endgroup$