Spline Interpolation Demo

Click on and move around any of the points that are being interpolated. The curve is redrawn as points are moved. For a brief explanation of what is going on, read on.

We use a relaxed cubic spline to interpolate the six points. This means that between each two points, there is a piecewise cubic curve. When we string these curves together, we set the second and first derivatives at the endpoints of each piecewise cubic curve equal to that of the adjacent cubic curve's second and first derivatives thus providing for a continuous second derivative. This gives a smooth curve that passes through each point, thus interpolating them. The term "relaxed" is used because the endpoints of the cubic spline have their second derivative equal to zero.

The construction of the relaxed cubic spline was done using Bezier curves as the piecewise cubic curves, thus four control points for each Bezier curve are needed. These are calculated from the original points we wish to interpolate. To view the control points and polygons, click on the Polygon button. Another method of interpolation uses a Lagrange polynomial .

Note: This and the related demos were written some time ago by then-student Mark Hoefer. For mathematical background, see course handouts on Lagrange interpolation , cubic Bezier curves , cubic spline curves , and nonuniform splines . (A couple of diagrams are not included, as they were physically pasted into the handouts.)

JAVA SOURCE CODE