## Quiz 2: Study Guide

Quizzes are open book. 30 minutes at the start of class

Topics:

• Interpolation

• Splines

Unless explicitly asked to compute a final answer, it is sufficient to write out the formula and plug-in values.

## Practice questions

1) What is a spline?

2) What is interpolation?

3) How does interpolation relate to splines?

4) What is keyframing? Describe an example.

5) How do splines relate to keyframing?

6) What does it mean for a spline to have C1 continuity?

7) What does it mean for a parametric curve to have affine invariance? linear precision?

8) What is the difference between extrapolation and interpolation?

9) Suppose we wish to interpolate between two colors: red and green. Write psuedocode to linearly interpolate between red and green in 10 steps.

10) In the following questions, assume we have the following control points which we wish to use for cubic interpolation

``````B0 = (80, 330)
B1 = (70, 180)
B2 = (260, 80)
B3 = (450, 210)``````
• Draw the control points.

• Using de Casteljau’s algorithm, show that the value of the curve at time t = 1 is b3.

• Recall that the formula for a nth Bezier curve is

$p(t) = \sum_{i=0}^n B_i^n(t) p_i$

where

$B_i^n(t) = \frac{n!}{i! (n-i)!} t^i (1 - t)^{n-i}$

What is the polynomial for the cubic Bezier curve? * Compute the value at t=1 using the Bernstein form of the cubic interpolation (plug-in the values, you do not need to solve) * Write pseudocode for drawing the Bezier curve. * Write pseudocode for moving the curve so that the first point starts at (0,0)

11) Suppose we use a quadratic polynomial (degree 2) instead of a cubic (degree 3)? What is the Bernstein polynomial for this function to interpolate two points b0 and b3? How would de Casteljau’s algorithm change? Show that the sum of Bernstein basis functions for a degree-2 sum to one.

12) What are some advantages and disadvantages of de Casteljau’s algorithm versus using the Bernstein formulation directly?

13) Suppose we wish to interpolate between the following values using a Catmull-Rom spline.

``````p0 = (-1, -3)
p1 = (2, 0)
p2 = (10, 3)
p3 = (0, 0)``````

Recall that we use the following formulas to compute intermediary control points in each segment.

$B0 = p_i \\ B1 = p_i + \frac{1}{6}(p_{i+1} - p_{i-1}) \\ B2 = p_{i+1} - \frac{1}{6}(p_{i+2} - p_{i}) \\ B3 = p_{i+1}\\$
• Draw the points.

• How many segments does this spline have?

• Consider the second segment. What are the formulas for B0, B1, B2, and B3?

• Consider the second segment. Draw the vector $p_{i+1} - p_{i-1}$

• What is the slope at p2?

14) How does a Catmull-Rom spline differ from a Hermite spline in terms of control points?

15) Suppose we have 3 keyframes. The first is at time = 1.0s. The second is at time = 5.0s. The last is at time = 6.0s. Suppose the application time is 4.0s. What segment of the spline would we interpolate and what would be the normalized time along that segment?

16) Suppose we wanted to use a spline to animate the position of a particle. What might the pseudocode look like?