Introduction to splines II - Bezier splines, etc.

Bezier splines:

A very popular interpolating spline is the Bezier spline. Unlike the Hermite spline, Bezier splines allow the user to do all manipulation by dragging around points. Here we have our two end points P1 and P4, which the curve goes through (which is why it's called an interpolating spline) but also two other "in-between" points P2 and P3, that guide the direction of the curve.

As we said in class, the Bezier spline is made from successively nesting linear interpolations.

The coefficients that you get when you do successive nested linear transformations are called the Bernstein polynomials, named for the mathematician who discovered them. Bezier cubic spline functions are simply the third order Bernstein polynomials.

Let's go over the math: We can implement linear interpolation by:

lerp(t, P1, P2) = (1-t) P1 + t P2
We can define a parabolic (ie: 2nd order) parametric curve, given three points P1, P2, P3, by nested linear interpolations:
lerp(t, lerp(t, P1, P2), lerp(t, P2, P3)) =

      (1-t) ((1-t) P1 + t P2) + t ((1-t) P2 + t P3)

Multiplying this out gives: (1-t)2 P1 + 2(1-t) t P2 + t2 P3

Similarly, we can define a cubic (ie: 3rd order) parametric curve given four points P1, P2, P3, P4, by nested linear interpolations:

lerp(t, lerp(t, lerp(t, P1, P2), lerp(t, P2, P3)), lerp(t, lerp(t, P2, P3), lerp(t, P3, P4))) =

      (1-t)3 P1 + 3(1-t)2 t P2 + 3(1-t) t2 P3 + t3 P4

Conveniently, the above equation contains four polynomials, each of which multiplies by only one of P1, P2, P3 or P4. These are in fact the third-order Bernstein polynomials. I've colored each polynomial differently so you can track them more easily in the following discussion.

These third-order Bernstein polynomials describe the cubic curves modulated by the geometric coefficients P1,P2,P3,P4, respectively, in terms of t3,t2,t and 1.

Now we just need to convert from one function basis to another:

We want
cubic functions
We have
geometric functions

The coefficients of the functions on the right give us the columns of the Bezier matrix:

a   -1 3 -3 1   P1
b 3 -6 3 0   P2
c-3 3 0 0   P3
d 1 0 0 0   P4

Homework due Wednesday April 30:

Optional things you can also try for extra credit: