Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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

share|improve this question
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 7 '12 at 0: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 7 '12 at 0:53
add comment

1 Answer

up vote 8 down vote accepted

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}]
share|improve this answer
    
Thanks, Vitaliy. –  Chris Degnen Dec 7 '12 at 1:05
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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