CS335 Fall, 2008 Homework 6 Solution Set (20 points) Due: November 6, 2008 (Thursday) ************************************************************************ 1. (Polygon Filling) Let V0, V1, ... V9 be the vertices of a polygon (in counter-clock- wise order) defined as follows: V0 = (1, 2) V1 = (6, 11) V2 = (11, 2) V3 = (11, 12) V4 = (9, 21) V5 = (9, 9) V6 = (6, 21) V7 = (3, 9) V8 = (3, 21) V9 = (1, 12) Build a Bucket-Sorted Edge Table for this polygon. Assuming the resolution of the screen is 20x22. (10 points) Solution: First note that two edges: e9=V8V9 and e4=V3V4, have to be shortened by one unit in y-direction (see the following figure).
The corresponding Bucket-Sorted Edge Table is shown below:
2. (Bezier Curves) Bezier curves satisfy "convex hull" property. That is, the curve is always contained in the convex hull of its control points. Why? Justify your answer. (5 points) Solution: Because each point of the curve is a linear combination of its control points. The four weights of a cubic Bezier curve are: (1-t)**3 , 3t(1-t)**2 , 3t**2(1-t) , t**3 It is easy to see that these weights are non-negative for 0 <= t <= 1 The sum of these weights is equal to 1. This follows from the following observation (1-t)**3 + 3t(1-t)**2 + 3t**2(1-t) + t**3 = [ (1-t) + t ]***3 = 1***3 = 1 Hence, each point of a cubic Bezier curve is indeed a linear (convex) combination of its control points. 3. There are several methods to compute points of a cubic Bezier curve. These methods include: Horner's rule, Forward differencing, and recurrence formula. Horner's rule and recurrence formula have been discussed in class. Which method is more efficient to compute a point of a cubic Bezier curve and why? (5 points) Solution: Horner's rule requires 3 multiplications and 3 additions for the evaluation of a point. Recurrence formula needs 6 multiplications and 12 additions/subtractiona for the eavluation of a point. Hence Horner's rule is more efficient for the evaluation of a single point.