# main-written3

### Question 1 - Bezier Curves

1A. A cubic Bezier in 2D has its control points at (0,0), (0,1), (1,2), (2,1). What is the value of the curve at u=.25? (the position of the point)

1B. If we want to cut the curve in part A into 2 pieces at u=.25, what would the control points be for each of the parts of the curve?

1C. What is the *direction* of the derivative (tangent vector) for the point in 1A? Give any vector that is parallel to the tangent vector. (getting the direction is easier than getting the magnitude. hint: use the answer to 1B)

1D. We want to connect another cubic Bezier curve to the end of the curve in 1A. If the two curves are to meet with C(1) continuity, where must its first two control points be?

1E. We want to connect a *quadratic* Bezier curve to the end of the curve in 1A. If the two curves are to meet with C(1) continuity, where must its first two control points be?

Hint: the deCasteljau algorithm is particularly useful to do 1A-1C

### Question 2 - Cardinal Curves

A Catmull-Rom Spline (a cardinal cubic with tension 0) has the control points:

(0,0) (0,1) (1,1) (1,0) (2,0) (2,1) (3,1) (3,0) (4,0) (4,1) (5,1) (5,0)

2A: Sketch this curve (if you are submitting the homework by email, don’t worry about turning this part in - but it will be useful to do to answer the next question)

2B: What is the bounding box for this curve?

2C: For the first segment of this curve (that is the cubic with control points (0,0) (0,1) (1,1) (1,0)), what would the control points be for an equivalent Bezier segment? Your answer should be the positions of the 4 Bezier control points.

Hint: the answer to 2C is useful in finding the answer to 2B

### Question 3 - Curve Derivations

In class (and in the book), we derived the basis matrix and functions for cubics. In this question, we’ll do it for quadratics (which are much simpler)

Consider a quadratic curve segment defined over the range u in 0,1.

We want to be able to specify 3 points: the beginning, middle (u=.5) and end of the segment. These will be our 3 “controls” (the P vector, using class notation).

3A. Write the constraint matrix that expresses the control point vector (P) as a function of the polynomial coefficients (A).

3B. What is the basis matrix? (you might want to use a computer to invert the 3x3 matrix. But solving the linear system for A in terms of P isn’t so hard to do by hand. Hint: the resulting matrix has only integers in it.)

3C. Use 3B to write out the basis functions.

### Question 4 - Lighting

For this question, ignore the Z direction, so the “polygon” is really just a line.

The floor is the line from the origin (0,0) to (10,0).

The eye point is in the ceiling, above the origin (0,10).

4A. Suppose you need to put a point light source at the same height as the eye (y=10), and want the end of the floor (10,0) to be as bright as possible. If the floor is very specular (but has no diffuse reflectance), where should you put the light source?

4B. If the floor was not specular at all, but ONLY had diffuse reflectance, where should you put the light source to get maximum brightness at (10,0) (putting the light source at the same height as the eye).

4C. Suppose the light source was at (5,10), and the floor was drawn as a single, Gouraud shaded “polygon”. If the floor was completely diffuse (no specular component), where would the brightest place on it be?

4D. As Question 4C, but this time, the floor is completely specular (although, assume that the exponent is not that big).