Geometric Modeling Notes A MATRIX FORMULATION OF THE CUBIC BÉZIER CURVE Kenneth I. Joy Institute for Data Analysis and Visualization Department of Computer Science University of California, Davis Overview A cubic Bézier curve has a useful representation in a matrix form. For most people this representation looks unusual, as most have not seen curves written in this way. It was initially developed to take advantage of the early GPUs on computer systems that could multiply matrices extremely fast especially matrices. We will use this form to develop subdivision matrices that allow us to use matrix multiplication to generate different Bézier control polygons for a cubic curve. There are lots of matrices here. They aren t overly complex, but may appear so with the mathematics. They form a good basis for us to discuss reparameterization of the Bézier curve, and have one realize that the same curve can have many different sets of Bézier control points. Developing the Matrix Equation A cubic Bézier Curve can be written in a matrix form by expanding the analytic definition of the curve into its Bernstein polynomial coefficients, and then writing these coefficients in a matrix form using the polynomial power basis. That is, P(t) ( t) + t( t) + t ( t) + t ( t) t( t) t ( t) t t t t 6
and so a cubic Bézier curve is can be written in a matrix form of t t t M where M 6 The matrix t t t M gives us the cubic Bernstein polynomials Check it out!. Utilizing equipment that is designed for fast matrix calculations, this formulation can be used to quickly calculate points on the curve. Subdivision Using the Matrix Form How do we use this new representation? Well, suppose we wish to generate the control polygon for the portion of the curve P(t) where t ranges between and subdivide the curve at the point t. This can be done with our divideand-conquer procedure, defined in this Unit. But it also can be done by modifying the parameters of the curve. That is, by defining a new curve Q(t) which is equal to P( t ). This new curve is a cubic polynomial, and traces out the desired portion first half of P as t ranges between and. We can calculate the Bézier control polygon for Q by using the matrix
form of the curve P, and by substituting t for the parameter. Q(t) P( t ) ( ( t t ( t ) ) ) 6 t t t 6 t t t MS, where we have introduced a new matrix S,. This matrix can be calculated directly by the
following: S, M M 6 6 6 So Q(t) is a Bézier curve, with a control polygon given by S, + + + + + + In the same way, we can obtain the Bézier control polygon for the second half of the curve the
portion where t ranges between and. If we call this new curve Q(t), then Q(t) P( + t ) ( + ) t ( + ) t ( + t ) t t t t t t MS, 6 6 where S, obtaining a matrix that can be applied to the original Bézier control points to produce Bézier control points for the second half of the curve. Now it may take some checking, but this is the identical result to our divide-and-conquer procedure, presented earlier. This difference here is the matrix representation, of course, but also that we used a reparameterization of the curve to obtain our new control points. Using the Matrix Representation to Generate New Sets of Control Points. Once we have used reparameterization to generate new control points, it is useful to do it again! With different reparameterizations. 5
Consider the portion of the cubic curve P(t) where t ranges between and, and let Q(t) be this new Bézier curve. We generate the Bézier control points of Q(t) by reparameterization of the original curve namely by replacing t by t + to obtain Q(t) P(t + ) (t + ) (t + ) (t + ) 6 t t t 6 t t t MS, where, after some calculation, S, is given by S, 6 Now, using a combination of S,, S, and S,, we can produce Bézier control polygons along the curve similar to methods developed with divided differences. To see what I mean here, first notice that S, S, S, This states that by applying S, to obtain a Bézier control polygon for the first half of the curve, we can then apply S, to this control polygon to obtain the Bézier control polygon for the second half of the curve. Extending this, if we apply S i, Sk, 6
(that is, apply S, k times and then S, i times), we obtain the Bézier control polygon for the portion of the curve where t ranges between i and i+. By repeatedly applying S k k,, we move our control polygons along the curve. Probably confusing for the first-timer, but reparameterization will be necessary when we start piecing Bézier curves together. These will be called B-spline curves. Summary We have developed a matrix form for the cubic Bézier curve. Using reparameterization, we developed matrices which enabled us to produce Bézier control polygons for sections of the curve. One can use reparameterizations over and over to generate new sets of control points for a particular Bézier curve. Thus there are an infinite number of control point sets for any Bézier curve. This gives us a lot of flexibility. Whereas we have developed this for cubic curves here, it can also be done with quadratic curves (the matrices are ), or nth-degree curves (where the matrices are (n + ) (n + )). All contents copyright (c) 997- Computer Science Department, University of California, Davis All rights reserved. 7