6
$\begingroup$

Can I get interpolated values from this B-spline, (shown in red)?

points = {{-2, 2}, {2, 2}, {6, 6}, {10, 7}, {14, 11},
   {18, 2}, {22, 1}, {26, 2}, {30, 1}, {34, 1}};

fn1 = Interpolation[points, Method -> "Spline"];
fn2 = Interpolation[points];

Show[ListPlot[points],
 Graphics[{Red, BSplineCurve[points]}],
 Plot[fn1[x], {x, -2, 36}],
 Plot[fn2[x], {x, -2, 36}],
 AxesOrigin -> {-2, 0}]

enter image description here

$\endgroup$
  • 1
    $\begingroup$ The red one is not interpolation - it passes only through the ends, not all points. So you need values of points along B Spline? $\endgroup$ – Vitaliy Kaurov Dec 7 '12 at 0:51
  • $\begingroup$ @Vitaliy - It would do to extract the points of the B-spline and interpolate them, but the B-spline is a graphics primitive, and I can't get the data out of it. $\endgroup$ – Chris Degnen Dec 7 '12 at 0:53
8
$\begingroup$

BSplineCurve is based on BSplineFunction. But BSplineFunction is analytic expression - so you do not need to interpolate it - you can use it as a (parametric) function:

g = BSplineFunction[points];
ParametricPlot[g[t], {t, 0, 1}]

enter image description here

If you still need points - this will work with any step:

bspts=Table[g[t], {t, 0, 1, .1}]
| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.