Bezier Curves and Splines

In general, a spline is a sequence of curves that are connected end-to-end -- that is, the last point of one curve is the same as the first point of the next curve in the sequence. A spline may lie entirely in one plane such as the x-y coordinate plane or reside in three-dimensional space.

If the z-coordinates of points in a curve are zero and the curve is drawn in the xy-coordinate plane, it may not have the same property as the graph of a function y = f(x). In particular, the curve may not pass the "vertical line test." Thus, when constructing equations to define a curve, we look to parametric equations of the form

x = a(u)
y = b(u)
z = c(u)
where a, b and c are expressions in the parameter u (i.e., functions of u).

Splines are very useful in computer graphics. They can be a motion path along which an object travels in an animation or the basic shape from which an extrusion or surface of revolution is constructed. Each of these models are illustrated in the tutorial.

Our interest in splines for the tutorial are those made up of a special type of curve called a Bezier curve. The coordinates of points in a Bezier curve are each defined by a polynomial of one parameter u. Further, the polynomials are a special kind called Bernstein polynomials. We will not dwell here on the properties of the polynomials nor of the curves they define but simply give the determining formulae.

The three parametric equations for the xyz-coordinates of a point on the Bezier curve are as follows:

where controlPoints is a two dimensional array of n+1 control points and for each i = 0, 1, .. n,

is a Bernstein polynomial of degree n.

Last,

represents the number of combinations of n things taken i at a time.

Suppose, for example, we use two control points that are established with the following declaration

double controlPoints[2][3] = { {-5.0,  3.0, 0.0},
                               { 4.0, -2.0, 0.0} };
In this case n = 1, and the following are the parametric equations for the x and y coordinates (note that the equation for z is simply z = 0.0).