7

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

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
Chris Degnen
  • 30,927
  • 2
  • 54
  • 108
  • 1
    The red one is not interpolation - it passes only through the ends, not all points. So you need values of points along B Spline? – Vitaliy Kaurov Dec 07 '12 at 00:51
  • @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. – Chris Degnen Dec 07 '12 at 00:53

1 Answers1

11

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}]
Vitaliy Kaurov
  • 73,078
  • 9
  • 204
  • 355