Recent Changes - Search:

CS559-2006 Web

Staff Login

Blending

Blending functions

My goal here is to explain blending functions in a way that will make sense for both interpolating curves (line segments, cardinal cubics) as well as B-Splines.

Suppose that we have n points P0, P1, ... Pn-1 that we want to make a curve from. The points can be in any dimension (probably 2 or 3).

Suppose that we want the curve to be made of polynomial segments of degree d.

One way to look at this curve is as a bunch of independent segments. Each segment will have its parameter u go from 0 to 1. Each segment of the curve will have d+1 control points.

Let's consider two specific examples:

  1. Suppose we have n=4 control points and want to have line segments (d=1). We'll have n-d=3 line segments. One from P0 to P1, one from P1 to P2, and so forth.
  2. Suppose we have n=7 control points and want to have cubic curve segments (d=3). To be specific, let's make them Catmull-Rom segments. We'll have n-d=4 curve segments. One that uses P0, P1, P2 and P1, another that uses P1, P2, P3 and P4, and one that uses P2, P3, P4 and P5, and one that uses P3, P4, P5 and P6.

As an aside, note that these curves are not closed. If you want to make a closed curve, you need to "loop around" the control points. It turns out that you need to add d extra segments, so for the second example above, we need to have a total of 7 curve segments, adding P4, P5, P6 and P0, P5, P6, P0 and P1, P6, P0, P1 and P2. We'll have a total on n curve segments to make a closed curve.

Blending Functions for Curve Segments

(this is the way we looked at things first in class)

For a degree d curve (which will have d+1 control points), we will have d+1 blending functions. Since I used P above, I'll use C here (C for control points or coefficients - remember that they are points). So, for our case of d=3...

f(u) = b0(u) C0 + b1(u) C1 + b2(u) C2 + b3(u) C3

Now lets go back to the example (2) above with n=6. We'll have to use this equation for each of the 4 curve segments. For the first curve segment, we'll have C0 be P0, C1 be P1 and so on. For the second curve segment, we'll have C0 be P1, C1 be P2 and so on.

So notice, that for any polynomial segment there are d+1 control points "active." Also notice that each control point will serve in several different "roles". In the example, P3 will be C3 in one segment, C2 in another...

Writing out the example, we see 4 functions (one for each curve segment), each is a sum of the same 4 blending function, but a different set of control points.

Or, to use a more general notation where j is the segment number (which will range from 0 to n-d-1):

fi(u) = b0(u) Pi + b1(u) Pi+1 + b2(u) Pi+2 + b3(u) Pi+3
(equation 1)

Again, notice that if things are cyclic (closed curve), we have n curves, and every control point gets used in every slot. There are no funny end cases.

Shifts: making one function

Having to think of our curve as 3 seperate segments is a little inconvenient. So instead, lets think of it as a single curve whose parameter ranges from 0 to n-d (since we have n-d-1 segments).

Remember: we'll use t for a parameter that isn't 0 to 1.

So, if we want to write a single f(t), it would be made up of the f'_i''(u) above:

f(t) = (equation 2)
if (t>=0 and t<1) f0(t)
if (t>=1 and t<2) f1(t-1)
if (t>=2 and t<3) f2(t-2)
if (t>=3 and t<4) f3(t-3)
(equation 2)

or, in general

f(t) = if (t>=i and t<i+1) fi(t-i)

But since all of the f are the same function (just being applied to different points), we can think of them as shifted copies of one another (the t-i).

Notice an annoying ugliness: I have chosen to make the intervals closed at the beginning. I can either have the nice symmetry, or I need to make the last segment be closed at both ends.

General blending functions

OK, now lets imagine creating a new set of blending functions for the "big" function f(t). I will denote these blending function with a capital B (as opposed to the b used for the original blending functions).

Notice that we will have n of the B blending functions (one for each control points).

To get the Blending functions:

  • We take equation 2, and plug equation 1 into it (4 times).
  • We do the summation outside of the if statement
  • We regather the terms

So we get:

f(t) =
  P0 B0(t) +
  P1 B1(t) +
  P2 B2(t) +
  ...
  Pn-1 Bn-1(t)

Where, for example

B3(t) =
if (t>=0 and t<1) b3(t)
if (t>=1 and t<2) b2(t-1)
if (t>=2 and t<3) b1(t-2)
if (t>=3 and t<4) b0(t-3)
otherwise, 0

So, notice that we've written the B blending functions as a function of shifts of the little B blending functions. More generally as a sum for any d and i.

(too hard to type onto the web)

Notice that the B blending functions are shifts of one another. For some of the blending functions, it will be shifted outside of the range that we will really access.

And what does this have to do with B-Splines?

Given a set of n points, and a degree of curve we want d, we need to make a set of n blending functions that will be defined over the parameter range 0 to n-d.

For cardinal cubics, we know the b functions, and we can create the B blending functions as above.

Notice some properties of the B functions:

  • they are splines (piecewise polynomials)
  • the pieces are of degree d
  • they are zero outside of a range (and the width of that range is d+1)
  • for any given t value, there will be d+1 of them that is not zero, and they will sum to one. (if there are enough of them)

For B-Splines, we know a bunch of properties that the B functions must have, and from these, we know there is exactly one set of functions that meet the restrictions - and these are the B-Splines.

Cardinal Splines are d-2 continuous. B-Splines are d-1 continuous.

History - Print - Recent Changes - Search
Page last modified on October 31, 2006, at 04:17 PM