| Parametric Cubic Curves | |
| the blight | November, 1998 |
In computer graphics you'll often need to draw curves, and there are times when a line list just won't cut it. What you want is something continuous. Something that is differentiable. Something that can be rendered with infinite precision. The cubic curve, my friend, is just the beast you seek.
The parametric function is, of course, our weapon of choice. Slope-intercept and general form equations have an annoying attribute that make them impossible to work with: namely, the geometric slope of a function may be infinite, creating a mathematical singularity. Parametric curves, however, never have infinite slopes. Our curve is described by a piecewise polynomial, that is, by a function x, a function y, and a function z. In a slope-intercept form function, the slope of a curve is defined by the infamous three words: "rise over run." When the "run" is zero, a dimensional vortex opens and sucks you away to the outer limits. Parametric functions, on the other hand, define slope as the sum of the parametric velocities: dx/dt i + dy/dt j + dz/dt k. Because we are limiting ourselves to parametric polynomials, these derivatives are always defined. Oh, happy day.
Our cubic curve can exist in any dimension. A one dimensional curve looks like a line segment; that isn't too interesting. A parametric curve defined with four or more piecewise polynomials is impossible to draw. Applications always use two and three dimensional cubic curves.
We define our cubic curve as the function Q(t). This function is in turn defined as a set of polynomials:
- Q(t) = [ f1(t) f2(t) ... fn-1(t) fn(t) ] , n = dimension of curve
- f1(t) = a1t3 + b1t2 + c1t + d1 , 0 £ t £ 1
- ...
- fn(t) = ant3 + bnt2 + cnt + dn
We define a time matrix T = [ t3 t2 t 1 ] and a coefficient matrix:
, where n is dimension of
the curve.
We can express Q(t) as the product Q(t) = T · C. We now have the definitions needed to start the cubic curve experience.
The cubic curves discussed here are all controlled by four characteristic points. The simplest of the cubic curves, the Hermite form, is defined by two endpoints and the tangent vectors at these endpoints. The following nine curves are defined by a Hermite characteristic matrix. The points represent the endpoint parameters, and the arrows point in the direction of the tangent vectors. Note that the arrow lengths do not correspond to the tangent vector magnitudes.

We define the Hermite basis matrix, MH, which relates the endpoints and tangent vectors on the hermite curve to the polynomial coefficients. Multiplying the Hermite geometry matrix, GH, with MH, effectively transforms GH from the Hermite geometry to produce the coefficients, CH, of the parametric function QH(t). Recall that the coefficients of the function QH(t) are described by the coefficient matrix, CH:
CH = MH · GH.
Our operand matrix, GH, parameterizes the endpoints and tangent vectors of the Hermite curve. The matrix takes the form
, where n
is dimension of the curve.
The elements P1 and P4 are the t = 0 and t = 1 positions of the curve. R1 and R4 are the t = 0 and t = 1 tangent vectors. This particular notation is used for consistency with later forms. We will now derive the Hermite basis matrix MH.
Recall from the previous section that for a generic parametric curve, Q(t) = T · C. Therefore, QH(t) = T · CH. We can evaluate the function at t = 0 and t = 1 to find the Hermite basis matrix that transform the P1 and P4 rows of the geometry matrix:
QH(t) = at3 + bt2 + ct + d = T · MH · GH = [ t3 t2 t 1 ] · MH · GH
QH(0) = P1 = a(0)3 + b(0)2 + c(0) + d = T · MH · GH = [ 0 0 0 1 ] · MH · GH
QH(1) = P4 = a(1)3 + b(1)2 + c(1) + d = T · MH · GH = [ 1 1 1 1 ] · MH · GH
Because the tangent vectors R1 and R4 are simply the velocities of the curve at t = 0 and t = 1, we can differentiate the function QH(t) and evaluate at t = 0 and t = 1.
QH'(t) = 3at2 + 2bt + c = T · MH · GH = [ 3t2 2t 1 0 ] · MH · GH
QH'(0) = R1 = 3a(0)2 + 2b(0) + c = T · MH · GH = [ 0 0 1 0 ] · MH · GH
QH'(1) = R4 = 3a(1)2 + 2b(1) + c = T · MH · GH = [ 3 2 1 0 ] · MH · GH
These four equalities can be written in matrix form:

We can now easily solve for the basis matrix MH by reducing the geometry matrix from both sides of the equation and inverting MH:
.
We now have found the Hermite basis matrix. The Hermite parametric cubic curve function is:
.
This efficient representation of the Hermite form allows the parametric function coefficients to be calculated in a single matrix multiplication. Unfortunately the magnitudes of the tangent vectors are somewhat of a mystery. Often the magnitudes need to be determined by trial and error, as a very large magnitude may be required to perturb the curve a small amount, or a small magnitude perturbs the curve too much. It is this problem that leads us to a more useful form of the parametric cubic curve: the Bezier form.
The Bezier form of the parametric cubic curve solves the problem that plagued the Hermite form: it provides a mechanism for relating the tangent vector magnitudes to points in space. The endpoints, P1 and P4, and the intermediate points, P2 and P3, of the Bezier geometry are resolved into the tangent vectors R1 and R4 of the Hermite geometry. We can transform matrices of the Bezier geometry to the Hermite geometry using the Hermite-Bezier change of basis matrix, and then transform from the Hermite basis to polynomial coefficients with the Hermite basis matrix presented in the previous section.
To help understand the effects of the intermediate control points, we will walk through the evaluation of the Bezier curve function QB(t). When t = 0, the function evaluates to the point P1. As t increases, the curve moves towards the other endpoint, P4, in a straight line (it is, after all, the shortest path between the two points). However, the intermediate control points deform this straight line. When t = .01, the value of the intermediate point P2 has more influence on the curve than the intermediate point P3. As t increases to .4, the intermediate control point P2 still has more control over the curve than P3. At t = .5, the intermediate points have equal influence over the curve. When t > .5, the control point P3 has the greater influence. We will get into the details of the intermediate control points in the next section. Imagine the intermediate control points deforming the line P1P4 as you consider the following curves.

We now define the relevant Bezier form matrices. The Bezier geometry matrix is similar to the Hermite geometry matrix, but it takes four control points, rather than two control points and two tangent vectors:
, where n is
dimension of the curve.
We also define the Hermite-Bezier change of basis: GH = MHB · GB.
To derive the Hermite-Bezier change of basis matrix, consider a curve in one dimension with constant velocity. The Bezier curve exposes an interesting property for this scenario: the control points are equally spaced. This graph shows a one dimensional Bezier curve with constant velocity.
|
We can use this graph to find the Hermite-Bezier change of basis matrix. This curve's function is obvious: Q(t) = (P4-P1)t + P1. The coefficient matrix follows: C = [ 0 0 P4-P1 P1 ]T. We can express the coefficient matrix as the product of the Hermite basis matrix and a Hermite geometry matrix. We can solve for the Hermite geometry matrix to find a relation between the Bezier intermediate control points and the Hermite tangent vectors:
.
Because P4 - P1 = 3l and P2 - P1 = l, R1 = 3(P2 - P1). Likewise, since P4 - P3 = l, R4 = 3(P4 - P3). We now have the four equations that relate the Hermite geometry to the Bezier geometry:
P1 = P1
P4 = P4
R1 = -3P1 + 3P2
R4 = -3P3 + 3P4
We now present the Hermite-Bezier change of basis matrix:
.
By definition, MB = MH · MHB. Therefore,
.
Our derivation of the Bezier form parametric polynomial is now complete. The function is as follows:
QB(t) = T · MB · GB.
Four control points is often not enough to define your curve with enough precision. The "natural cubic spline" accomodates n control points, but calculating the polynomial coefficients requires solving for a n + 1 by n + 1 matrix. This can become extremely demanding on the computer. Additionally, moving a single control point may change the shape of the natural cubic spline wildly. In response to these problems, graphics programmers usually join together multiple cubic curves to approximate a curve fit to an arbitrary number of control points . To achieve continuity, the curve segments must share control points. Below are two Bezier curves joined together through control point P4:
![]() |
This looks swell. Look how smooth the curve is. Now lets move control point P5 and see what happens:
![]() |
Curses! Two curves joined by a single point are not smooth. Let's define Cn continuity as the equivalence of the nth derivatives of the left and right curves at their joint. Two Bezier curves that share P4 achieve C0 continuity - that is, their endpoints have equal positions. They do not, however, achieve C1 continuity - the tangent vectors at their endpoints are not necessarily equal. Is there a way to join two Bezier curves together to achieve C1 continuity? Yes.
We define a function L(t) that refers to the left Bezier curve of our two-curve system, and similarly define a function R(t) that refers to the right Bezier curve. C0 continuity is achieved when L(1) = R(0). In the example above, this is true because L(1) = P4 and R(0) = P4. C1 continuity relates to the velocity of the curve, and is achieved when L'(1) = R'(0). Recall the Bezier-Hermite geometry equivalencies from the previous section:
R1 = -3P1 + 3P2
R4 = -3P3 + 3P4
R1 and R4 are the velocities of the curves evaluated at t = 0 and t = 1. Therefore, C1 continuity of two joined Bezier curves is achieved when 3(P4 - P3) = 3(P5 - P4), or P4 - P3 = P5 - P4. The following two systems are joined Bezier curves with C0 and C1 continuity:
![]() |
![]() |
This scheme allows the joining of Bezier curves with first degree continuity. There is no evident relationship between the Bezier control points and the second derivative of the curve. C2, the second degree of continuity, is achieved when the acceleration of the curves are equal at the joints. We introduce a new form of the parametric cubic curve that achieves C2 continuity: the B-spline.
The B-spline is defined by a set of control points P0, P1, ..., Pm-1, Pm, for m ³ 3 with m - 2 curve segments. The curve segments are named Q3(t), Q4(t), ..., Qm-1(t), Qm(t). We define each curve segment Qi(t), for 3 £ i £ m in its own time domain (that is, each segment is defined for 0 £ t £ 1), and adjust the spline domain ti to 0£ t £ 1, for 3 £ i £ m, when evaluating segments. B-splines come in many flavours: nonrational uniform, nonrational nonunfirom, and rational nonuniform. In a uniform spline, every curve segment is defined over a domain 0 £ t £ 1. The nonuniform spline is a generalization of the uniform spline - this restriction has been lifted. Rational splines are defined in homogenous space (i.e. evaluation of the function requires homogenizing each term by some function W). The B-spline covered here is uniform and nonrational.
Like the two cubic curves discussed in the previous sections, segments of the nonrational uniform B-spline are defined by four control points. The function for each segment is defined in the now-familiar way: Qi(t) = Ti · Ms · Gsi, for 3 £ i £ m, where Ms is the B-spline basis matrix and Gsi is the geometry matrix for the ith segment. Each geometry matrix is composed of four consecutive control points:
, where n is
the dimension and 3 £ i £ m.
The following two systems are B-splines constructed from four cubic curves. Where each curve segment joins, we can draw a point called a "knot." The knots are named the spline domain at that point, that is, ti for 3 £ i £ m.
![]() |
![]() |
How does the B-spline form of the parametric cubic curve achieve C2 continuity? The answer, of course, is in the B-spline basis matrix Ms. To derive Ms we need to look back at the Bezier form.
Recall that the Bezier function, QB(t), is defined as the product of the time matrix, Bezier basis, and the Bezier geometry matrix:
QB(t) = T · MB · GB.
Expanding this product we find that:
QB(t) = (-t3 + 3t2 - 3t + 1)P1 + (3t3 - 6t2 + 3t)P2 + (-3t3 + 3t2)P3 + t3P4
We can use factoring to clean up this function:
QB(t) = (-t3 + 3t2 - 3t + 1)P1 + 3t(t2 - 2t + 1)P2 + 3t2(-t + 1)P3 + t3P4
Upon seeing this we say, "Holy Cow." The coefficient on each control point is a row from Pascal's triangle. This means we can factor each coefficient into a binomial expression:
QB(t) = (1 - t)3P1 + 3t(1 - t)2P2 + 3t2(1 - t)P3 + t3P4
This shows very clearly how each control point affects the curve at time t. We call each coefficient a "blending function" of the Bezier form:
B1(t) = (1 - t)3
B2(t) = 3t(1 - t)2
B3(t) = 3t2(1 - t)
B4(t) = t3.
We can think of each blending function as a weight on its respective control point. By examining the graph of the blending functions we can understand how each control point affects the Bezier curve at some time t:
![]() |
The first impression is symmetry. At t = .25, the B1 blend function has a value equal to the B4 blend function at time t = .75. The same is true for B2 and B3. We can also graph the sum of the blend functions:
![]() |
This graphs claims that S Bi(t) = 1, for 0£ t £ 1. Can it really be?
B1(t) + B2(t) + B3(t) + B4(t)
= (1 - t)3 + 3t(1 - t)2 + 3t2(1 - t) + t3
= (-t3 + 3t2 - 3t + 1) + 3t(t2 - 2t + 1) + 3t2(-t + 1) + t3
= (-t3 + 3t2 - 3t + 1) + (3t3 - 6t2 + 3t) + (-3t3 + 3t2) + t3
= 1.
Indeed, the sum of the Bezier blend functions is one for all values of t. This means that QB(t) is a weighted average of the control points with respect to t. This is a significant property, and it will help in the derivation of the B-spline basis matrix.
To avoid subscript proliferation, we redefine B1(t), B2(t), B3(t), and B4(t) to be the blending functions of the B-spline. The values of these functions at time t are the weights of the control points on the curve at t. Like in the Bezier form, we want the sum of the blending functions to equal one at any time. This means that each B-spline segment function is the weighted average of its control points at t, for 0£ t £ 1:

We construct the B-spline basis matrix such that segment Qi(t) evaluated at t = 1 will have the same position, derivative, and second derivative as Qi+1(0) evaluated at t = 0. That is, we need assurance that C0, C1, and C2 continuity is achieved.
Two consecutive B-spline segments, Qi(t) and Qi+1(t) are defined by five control points: Pk for i - 3 £ k £ i + 1. Using this powerful notation, we define:
Qi(t) = B1(t) · Pi-3 + B2(t) · Pi-2 + B3(t) · Pi-1 + B4(t) · Pi
Qi+1(t) = B1(t) · Pi-2 + B2(t) · Pi-1 + B3(t) · Pi + B4(t) · Pi+1.
Additionally, to assure continuity:
Qi(1) = Qi+1(0)
Qi'(1) = Qi+1'(0)
Qi''(1) = Qi+1''(0).
To setup the derivation, we simply apply our new definition of the curve segment into the equalities from above:
B1(1) · Pi-3 + B2(1) · Pi-2 + B3(1) · Pi-1 + B4(1) · Pi = B1(0) · Pi-2 + B2(0) · Pi-1 + B3(0) · Pi + B4(0) · Pi+1
B1'(1) · Pi-3 + B2'(1) · Pi-2 + B3'(1) · Pi-1 + B4'(1) · Pi = B1'(0) · Pi-2 + B2'(0) · Pi-1 + B3'(0) · Pi + B4'(0) · Pi+1
B1''(1) · Pi-3 + B2''(1) · Pi-2 + B3''(1) · Pi-1 + B4''(1) · Pi = B1''(0) · Pi-2 + B2''(0) · Pi-1 + B3''(0) · Pi + B4''(0) · Pi+1.
This is not a system you'd want to meet in a dark alley. Recall that the blending functions are cubic polynomials:
Bi(t) = ait3 + bit2 + cit + di.
In our discussion of the Bezier blending functions, it was shown that the blending function coefficients are actually the elements from the basis matrix. The same is true here. By solving for the 16 blending function coefficients (four functions each with four coefficients) we derive the B-spline basis matrix.
We can solve the three continuity equations above by setting each Bk(1) · Pi+k-1 = Bk-1(0) · Pi+k-1, for 1 £ k £ 4:
| B1(1) · Pi-3 = 0 · Pi-3 | B2(1) · Pi-2 = B1(0) · Pi-2 | B3(1) · Pi-1 = B2(0) · Pi-1 |
| B4(1) · Pi = B3(0) · Pi | 0 · Pi+1 = B4(0) · Pi+1 | B1'(1) · Pi-3 = 0 · Pi-3 |
| B2'(1) · Pi-2 = B1'(0) · Pi-2 | B3'(1) · Pi-1 = B2'(0) · Pi-1 | B4'(1) · Pi = B3'(0) · Pi |
| 0 · Pi+1 = B4'(0) · Pi+1 | B1''(1) · Pi-3 = 0 · Pi-3 | B2''(1) · Pi-2 = B1''(0) · Pi-2 |
| B3''(1) · Pi-1 = B2''(0) · Pi-1 | B4''(1) · Pi = B3''(0) · Pi | 0 · Pi+1 = B4''(0) · Pi+1 |
We can reduce the control point term from both sides of all equations. This brings us a step closer to the solution:
| B1(1) = 0 | B2(1) = B1(0) | B3(1) = B2(0) |
| B4(1) = B3(0) | 0 = B4(0) | B1'(1) = 0 |
| B2'(1) = B1'(0) | B3'(1) = B2'(0) | B4'(1) = B3'(0) |
| 0 = B4'(0) | B1''(1) = 0 | B2''(1) = B1''(0) |
| B3''(1) = B2''(0) | B4''(1) = B3''(0) | 0 = B4''(0) |
Because each blending function is a cubic polynomial, we can rewrite the fifteen equations from above in terms of the blending function coefficients. For example, B1(1) = 0 is equivalent to:
(a1t3 + b1t2 + c1t + d1)t=1 = 0
a1(1)3 + b1(1)2 + c1(1) + d1 = 0
a1 + b1 + c1 + d1 = 0.
The ten first and second differential equations can be rewritten in a similar way. For example, B1'(1) = 0 is equivalent to:
B1'(t) = 3a1t2 + 2b1t + c1
(3a1t2 + 2b1t + c1)t=1 = 0
3a1(1)2 + 2b1(1) + c1 = 0
3a1 + 2b1 + c1 = 0
The previous fifteen equations are equivalent to:
| a1 + b1 + c1 + d1 = 0 | a2 + b2 + c2 + d2 = d1 | a3 + b3 + c3 + d3 = d2 |
| a4 + b4 + c4 + d4 = d3 | 0 = d4 | 3a1 + 2b1 + c1 = 0 |
| 3a2 + 2b2 + c2 = c1 | 3a3 + 2b3 + c3 = c2 | 3a4 + 2b4 + c4 = c3 |
| 0 = c4 | 6a1 + 2b1 = 0 | 6a2 + 2b2 = 2b1 |
| 6a3 + 2b3 = 2b2 | 6a4 + 2b4 = 2b3 | 0 = 2b4 |
We are trying to solve for a matrix with 16 elements, so we'll need 16 equations. Recall that the sum of the blending functions at any time is one. Each blending function can be evaluated at any time, but we'll choose to evaluate it at t = 0 because the coefficients on twelve variables in the equation become zero, so those variables drop out entirely:
B1(0) + B2(0) + B3(0) + B4(0) = 1
d1 + d2 + d3 + d4 = 1
Finally, it's time to solve for the B-spline basis matrix. If you are sufficiently crazy, you can load the coefficients on each of the 16 equations into a 16x16 matrix and Gaussian eliminate to solve. I'll just use Mathematica:
![]() |
Oh, happy day! We can factor out a 1/6 to make the basis matrix easier to write:
.
In conclusion, a B-spline segment is defined as:
.
You now have an understanding of the Hermite, Bezier, and B-spline parameterizations of parametric cubic curves. These cubic curves have applications that extend beyond the realm of graphics. Because they are continuous and piecewise differentiatable (the B-spline even has a defined second derivative at segment joints), cubic curves can be used to parameterize object transformations. Unlike Euler angles, object rotation fit to a cubic curve is unambigious. Additionally, no expensive trigonometry operations are required for evaluation. The bicubic surface, an elegant application of parametric cubic curves, can replace the discrete and storage-intensive triangle mesh in many scenarios. The uses of parametric cubic curves are numerous, and I feel deeply honored to have helped create a spline-friendly world.
| Sean Baxter |
References:
James Foley, Andries van Dam, et al., Computer Graphics : Principles and Practice, (Reading, Massachusetts; Addison-Wesley, 1996).
Alan Watt and Mark Watt, Advanced Animation and Rendering Techniques, (New York: Addison-Wesley, 1992).