Bezier curves and Spline curves

Using control points with blending functions

All of the techniques that we look at in this chapter are based on forming weighted averages of a set of control points. Mathematically, this looks like

Because the averages are formed by using so called blending functions, the point that falls out of this process is a function of t. Bezier curves are formed by using four control points in combination with the Bernstein polynomials of order three as blending functions.

It is possible to extend this method to more control points than four by using higher order Bernstein polynomials, but curves built in this way are difficult to work with.

Good and bad features of Bezier curves

Some good features of the Bezier curve include

  1. Curves formed in this way are invariant under affine transformations. In practice this means that if we are going to apply transformations to a curve we only have to apply the transformations to the set of control points and then render the curve based on the transformed control points.
  2. Bezier curves stay confined to the convex hull formed by the control points. This makes clipping calculations easier to do.

Bad features include

  1. Because the blending functions are non-local moving a single control point affects the entire curve.
  2. In situations in which we try to use more than the traditional four control points, the effect that a given control point has on the curve is hard to predict.
  3. Higher order Bernstein polynomials are numerically unstable and hard to compute.
  4. Bezier curves are not invariant under perspective transformations.

Spline curves

In an effort to address some of the bad points raised here, Bernstein polynomials can be replaced with spline curves. A spline curve is a curve composed of segments that are usually polynomials of relatively low degree. Splines can be sculpted to have desirable shapes and can be made to vanish outside some limited region called the span. This helps with problem 1 above. Because the individual curves usually have fairly low degree splines are not as susceptible to problem 3 above.

B-splines

Spline curves can be constructed in a variety of ways. One of the most widely used algorithms for constructing spline curves is based on a simple recursive formula:

The points tk are called knot points. Roughly speaking, knot points are points at which the various segments that make up the spline are joined together. To completely specify a B-spline curve of order m with L control points we have to specify a knot vector (t0, t1, …, tL + m).

Values in the knot vector can be repeated. If a given t value appears n times in the list we say that that knot has multiplicity of n. The most commonly used knot vector is the so-called standard knot vector in which the first and last knots have multiplicity m and the other knots have unit spacing. In the special case when L is 3 and m is 4, if we choose the standard knot vector (0,0,0,0,1,1,1,1) the B-spline functions reduce to the Bernstein polynomials of degree three and we get the usual Bezier curve.

NURBS

B-spline curves have all of the desirable characteristics of Bezier curves and additionally avoid problems 1-3 listed above. The one remaining problem is that B-spline curves are not invariant under perspective transformations.

There is however a class of curves based on the B-spline curves which is invariant under perspective transformations. These curves are the Non-uniform rational B-splines, or NURBS for short. These blending functions are computed from the B-spline functions by

The weight values wk that appear in this formula can be set arbitrarily. The only restriction is that they must all be positive values and they must not all be the same.