CS335
Fall, 2008
Homework 9 (20 points)
Due: November 27, 2008 (Thursday)
************************************************************************
1. (Polygon Clipping)
To ensure a given polygon is clipped properly against a window,
sometimes we have to use Weiler-Atherton's clipping algorithm.
For that particular algorithm, if we are clipping a polygon
against the left boundary of a window, where should we start the
clipping process? Justify your answer. (10 points)
Solution:
To ensure proper output of the process, clipping should start with
the lower left vertex of the polygon on the OUT side of the bounding
edge.
2. (Rendering of B-spline Curve Segments)
To render a cubic B-spline curve segment, one possibility is to
convert the B-spline control points P0, P1, P2, and P3 into Bezier
control points Q0, Q1, Q2 and Q3, using the following formula
Q1 = P1 + (P2 - P1)/3
Q2 = P1 + 2(P2 - P1)/3
A = P1 + (P0 - P1)/3
B = P2 + (P3 - P2)/3
Q0 = (A + Q1)/2
Q3 = (B + Q2)/2
and then render it using techniques developed for cubic Bezier
curve segments. Why do we know Q0, Q1, Q2 and Q3 defined the
above way are the Beizer control points of the cubic B-spline
curve? (5 points)
Solution:
It is sufficient to show that a Bezier curve representation using
Q0, Q1, Q2 and Q3 as the control points can be converted to a
B-spline curve representation with P0, P1, P2 and P3 as its
control points.
C(t) = (1-t)^3[Q0] + 3t(1-t)^2[Q1] + 3t^2(1-t)[Q2] + t^3[Q3]
= (1-t)^3[(P1 + (P0-P1)/3 + P1 + (P2-P1)/3)/2]
+ 3t(1-t)^2[P1 + (P2-P1)/3] + 3t^2(1-t)[P1 + 2(P2-P1)/3]
+ t^3[(P2 + (P3-P2)/3 + P1 + 2(P2-P1)/3)/2]
= (1-t)^3/6[P0 + 4P1 + P2] + t(1-t)^2[2P1 + P2]
+ t^2(1-t)[P1 + 2P2] + t^3/6[P1 + 4P2 + P3]
= (1-t)^3/6[PO]
+ (4(1-t)^3/6 + 2t(1-t)^2 + t^2(1-t) + t^3/6)[P1]
+ ((1-t)^3/6 + t(1-t)^2 + 2t^2(1-t) + 4t^3/6)[P2]
+ t^3/6[P3]
= (1-t)^3/6[PO] + (4-6t^2+3t^3)/6[P1]
+ (1+3t+3t^2-3t^3)/6[P2] + t^3/6[P3].
3. (Homogeneous Coordinates)
What is the main reason for us to use homogeneous coordinates in
computer graphics? Why? (5 points)
Solution:
Using homogeneous coordinates, all transformations can be represented
as vector-matrix multiplications, including translation. Hence, even
multiple transformations have been performed, since the corresponding
matrices can be accumulated into a single matrix, we only need to do
one vector-matrix multiplication to implemet all those transformations.
************************************************************************
Put you solution set in a text file and send the text file to the grader
(xuwei.liang@uky.edu) before midnight of the due day.
CS535 (Fall 2008)
Solution of Homework 9
Due: 11/27/08
Name: xxxxxx xxxxxx