B-Spline how to create control points for a curve to pass through knot values

990 Views Asked by At

I want to create a b-spline curve that will pass through all the (knot) points I give it. How do I construct it? Do I need to find the control points for that curve? And if so - how?

2

There are 2 best solutions below

2
On

Suppose that your knot points (not to be confused with the B-spline knots!) are ordered in a sequence $(x_1, \dots, x_m)$. Then you can compute a B-spline of order $n$ between each ordered pair $(x_i, x_{i+1})$. You can adjust $n$ in order to set the B-spline regularity.

0
On

Follows a MATHEMATICA script showing how to construct a special spline type. (Bézier curves) In the script $BL, BQ,BC$ are Bézier curves of first, (linear), second (quadratic) and third (cubic) order and also how them are recursively built. The points $p_1,p_2,p_2,p_4$ can be considered as control points. By properly positioning these control points, we can cause the curve to pass through determined points

$$ \begin{array}{l} {\text{BL}[\text{p0$\_$},\text{p1$\_$},\text{t$\_$}]\text{:=}(1-t)\text{p0}+t \text{p1}}\\ {\text{BQ}[\text{p0$\_$},\text{p1$\_$},\text{p2$\_$},\text{t$\_$}]\text{:=}(1-t)\text{BL}[\text{p0},\text{p1},t]+t \text{BL}[\text{p1},\text{p2},t]}\\{\text{BC}[\text{p0$\_$},\text{p1$\_$},\text{p2$\_$},\text{p3$\_$},\text{t$\_$}]\text{:=}(1-t)\text{BQ}[\text{p0},\text{p1},\text{p2},t]+t \text{BQ}[\text{p1},\text{p2},\text{p3},t]} \end{array} $$

$$ \begin{array}{l} {p_1=\{0,0\};}\\ {p_2=\{1,1\};}\\ {p_3=\{-1,2\};}\\ {p_4=\{-2,0\};}\\ {\text{gr1}=\text{ParametricPlot}\left[\text{BC}\left[p_1,p_2,p_3,p_4,t\right],\{t,0,1\},\text{PlotStyle}\to \{\text{Blue},\text{Thick}\}\right];}\\ {\text{grp}=\text{Table}\left[\text{Graphics}\left[\left\{\text{Red},\text{Disk}\left[p_k,0.05\right]\right\}\right],\{k,1,4\}\right];}\\ {\text{grl}=\text{ListLinePlot}\left[\left\{p_1,p_2,p_3,p_4\right\},\text{PlotStyle}\to \{\text{Dashed}, \text{Red}\}\right];}\\ {\text{Show}[\text{gr1},\text{grp},\text{grl},\text{PlotRange}\to \text{All}]} \end{array} $$

Attached a plot for this setup

enter image description here