CSCI 480/580 Lecture 29 - In-Class Problems

Let’s derive the contstraint matrix for a Hermite Spline, which is a cubic polynomial with its four control points defined by the position and derivative at the start and end of the cubic segment.

  1. The form for our cubic polynomial is: \(f(u) = a_0 + u a_1 + u^2 a_2 + u^3 a_3\). Just so that we have it handy, let’s start by computing the first derivative of our polynomial.

  2. Now let’s derive the constraint matrix. For each of the following control points, write the corresponding row of the constraint matrix by plugging in the \(u\) value into \(f\) or \(f'\).

    1. The first control point is the position of the start: \(p_0 = f(0)\)
    2. The second is the derivative at the start: \(p_1 = f'(0)\)
    3. The third is the position at the end: \(p_2 = f(1)\)
    4. The fourth is the derivative at the end: \(p_3 = f'(1)\)
  3. Invert the constraint matrix to find the basis matrix. Feel free to use Julia or similar.

Now we’ll derive the constraint matrix for a Bézier spline. The control points have almost the same meaning as in a hermite spline, except that the tangents are specified more intuitively as the difference between a pair of points. Another tweak made for convenience is to multiply the tangents by a factor of 3 - this makes it easier to have curves with large derivatives without having to place the control points super far away.

  1. Write out a constraint equation for each of the following control points; they will not immediately look like the constraints we’ve seen before, since the left-hand side is not just a single control point.
    1. Start: \(f(0) = p_0\)
    2. End: \(f(1) = p_3\)
    3. Derivative at start: \(f'(0) = 3(p_1 - p_0)\)
    4. Derivative at end: \(f'(1) = 3(p_3 - p_2)\)
  2. This doesn’t just give us a set of equations that can be converted nicely into matrix form. However, we can achieve this by rearranging the equations to solve for each of the \(p\)’s (or for each of the \(a\)’s). Based on this, Derive the Bézier basis matrix, either directly or by deriving the constraint matrix and inverting it.

At this point, you have what you need to get started on the spline lab: the first step of that lab is to plug in your matrix and write code that uses it to evaluate points along the curve.