7
$\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$
2
  • 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$ Dec 7, 2012 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$ Dec 7, 2012 at 0:53

1 Answer 1

11
$\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}]
$\endgroup$
1
  • 1
    $\begingroup$ Great question, great answer. Thanks guys. $\endgroup$
    – Jake Mirra
    Oct 14, 2021 at 7:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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