CS 248: Final Solutions

Question 3

Grader: Matt Pharr

3a

This question was actually a lot more straightforward than many people thought it was. The question reminds you that Perlin's noise function is supposed to have a value of zero at integer lattice points, and you're given m0 and m1, the derivatives at t=0 and t=1. The important thing to remember about the Hermite basis functions is that they take the value of a function at two points and the derivatives at those two points and interpolate it. See lecture 13 for more details.

So, we know that P(0) = 0 and P(1) = 0. Furthermore, P'(0) = m0 and P'(1) = m1. Therefore, the spline that interpolates them is:

  P(t) = 0 * H0(t) + 0 * H1(t) + m0 * H2(t) + m1 * H3(t)
       = m0 * H2(t) + m1 * H3(t)
That's it. Many people almost got this right, but thought that P(1) = 1; this cost three points. If you wrote out the general Hermite spline formula like this:

  P(t) = P0 * H0(t) + P1 * H1(t) + P'(0) * H2(t) + P'(1) * H3(t)
And correctly identified the values of P0, P1, P'(0), and P'(1), you lost one point for not simplifying it down taking into account the zero terms. If you associated the wrong basis functions with the wrong input values, you lost three to five points, depending on how many of them you got wrong.

Many people didn't remember the above-mentioned properties of Hermite splines and tried to work out the actual polynomial. Most of these folks started writing out the Hermite basis matrix (those of you who remembered it correctly are out of control) and deriving the polynomial. For the record, the correct polynomial is:

  P(t) = (m0 + m1) * t^3 - (2 * m0 + m1) * t^2 + m0 * t
Getting that right was worth full credit and the respect of your TA. Slight errors in remembering the matrix were just -1 point, more egregious matrix errors were -5 or more, depending on whether it looked like you had the right idea but forgot the details or whether you seemed to be just writing out something similar to the correct matrix to try to get a few points.

3b

There were two main things to figure out for this part of the question. The first was that if we want to have a function that was defined over the range 0 - 1 to be defined over the range 0 - 1/2, we can compute f(2t) rather than f(t). However right or wrong your answer in the first part of the quesion was, making sounds along these lines was worth about three points.

The other thing to realize was that if we want the derivatives of this function to match up with the derivatives we're given (m0, m1/2, m1, etc.), we need to divide the function by two. (By the chain rule, what is the derivative of f(2t), etc...) Given that, the correct answer is the following.

For t between 0 and .5, compute:

  P(t) = .5 * m0 * H2(2t) + .5 * m1/2 * H3(t)
Similarly for other values of t. (e.g. t between .5 and 1, compute f(2t - 1), etc.)

Forgetting to scale by 1/2 was -2 points. Other creative but incorrect solutions could get partial credit, depending on how reasonable they were.