Page 9: Cubics

Spring 2026 Sample Solution

We will create complicated shapes by putting together simple pieces. We need to do this carefully; otherwise, we won’t get continuity.

If we try to make shapes out of linear pieces (line segments), we can never do better than continuity (except for a straight line). The common practice in computer graphics is to use cubic polynomial segments. That will allow us to get (or better) continuity, and also have a lot of flexibility in the shapes that we can create.

We could use even higher-degree polynomials (quartic polynomials, quintic polynomials, etc.). However, for many reasons, in computer graphics, cubics are usually sufficient.

(optional) If you want to see this material in more depth, you can look at the Splines Notes (similar to the book chapter) on Polynomial Pieces. The notes focus on deriving different forms of the polynomials, which is not something we need to do for class.

Piecewise Polynomials

We will be making our curves by breaking a large curve into a series of smaller segments, and representing each segment as a polynomial. Our curves are piecewise polynomials because each piece is a polynomial. Mathematicians use the term spline to refer to piecewise polynomials; however, this term sometimes has other connotations.

Before considering the pieces, we should be clear about how they fit together. For the moment, denote the overall curve as for in some range. We construct this curve from a list of segments that are also curves: , , etc. Each of the segments applies to some portion of the “overall time,” so we could do something like:

for however many pieces we might have, with the slight caveat that we need to deal with closing the interval at the end (so applies over the range ).

This is somewhat inconvenient, since it means each segment must be defined in terms of where it goes in the overall time. It is much better (and more common) to define each segment as spanning the range (or if appropriate), so:

Of course, we could choose to make the “breakpoints” where we switch functions occur at other times, and shift and scale time accordingly so that each gets the appropriate range.

Since each of our pieces is a polynomial, we know that within each piece we have continuity (for all derivatives). Therefore, we only need to be concerned about continuity where the functions switch. If we want continuity, we need to make sure (the end of one piece equals the beginning of the next). If we want continuity, we need to make sure that (the first derivative at the end of one segment is equal to the first derivative at the beginning of the next).

Polynomials

A polynomial is a function of a single parameter (in this case ):


The are sometimes referred to as coefficients.

A few simple observations:

  1. If we have a polynomial of degree (that is, the highest power of the polynomial is , so there is a term), we have coefficients.
  2. We can write the coefficients as a vector of length .
  3. We can think of a quadratic (a degree-2 polynomial) as a cubic (a degree-3 polynomial) with its coefficient as 0.
  4. While the equation is non-linear in the parameter, it is linear in the coefficients. That is, for a given value of the parameter , is a linear function of the coefficients .

There are many different ways to write a polynomial. The “coefficient form” above is just one way to write it. For example, if we have a cubic polynomial with the coefficient vector , which gives us (we put first in the vector), we could also put it in the form .

This idea of having different forms of polynomials will be important. Ultimately, they are all the same polynomial, but some forms will be easier to work with than others.

Cubics

A cubic is a polynomial of degree 3.

We write a cubic polynomial (in coefficient or canonical form) as

and denote the coefficients as (in boldface since they are vectors). This is a nicer notation than writing (if our vectors are 2D):

It’s useful to remember that we have a separate function for each dimension ( for the x-coordinate and for the y-coordinate).

Notice that a cubic segment has 4 coefficients. When we specify the cubic in some other way, we need to give enough information to compute these four values. If we give too little information or too much, it won’t work exactly. Therefore, other representations will use 4 numbers too.

Trying to control the cubic by specifying the coefficients is not easy (e.g., what values for and give a desired shape?). Therefore, we almost always specify cubic curves using some other form.

If we want to connect cubics, we would like to specify the beginning (where ) and end (where ). Let’s call these points and . If we write things in canonical form, the beginning is straightforward:

The end is a bit more complicated.

The problem is that we have many choices, and this doesn’t say what happens in between the endpoints.

The solution will be to use different forms for the cubics. We’ll specify values that are convenient, and compute the coefficients from these. Alternatively, we can think of these different representations and simply use the polynomials in these other forms. As an analogy, if I ask you to compute for the cubic polynomial in the last section, you can compute it by plugging the number into the factored form without figuring out what the coefficients are.

On the next page, we’ll learn about a particularly useful form for cubics. But first, a quick question to check your understanding.

A Cubic Question

To check your understanding, answer this question:

We would like to make a cubic curve that starts () at the point 10,5 and ends at the point 50,75. Assume we write the cubic in the canonical form. Give values of the coefficients (A0, A1, A2, A3) that satisfy the endpoints (there are many correct answers - give any one).

A0: ,
A1: ,
A2: ,
A3: ,

Answer

A0 has to be 10,5 so that f(0) has the right value. Otherwise, as long as the X and Y of the points add up to 50 and 75 respectively, it will work.

Here is one answer:

a0 = 10, 5
a1 = 0, 0
a2 = 0, 0
a3 = 40, 70
Next: Page  10 - Comparing Interpolation Methods