CS335
Fall, 2008
Homework 5 (20 points)
Due: October 30, 2008 (Thursday)
************************************************************************
1. (bezier.java)
Modify the code presented in the lecture example (pages 222-225,
Graphics I) so that once four control points have been input by
the user (a cubic Bezier curve will be generated then), the user
can INTERACTIVELY move any of the four control points of the
Bezier curve. The curve should be re-drawn interactively as a
control point is dragged. (8 points)
(Test the sample program "Bezier Curve" to see how such a program
should run)
2. (triangle.java)
Write a java program which will initially draw a triangle in the
center of the window and then repeatedly take an input value x (an
integer between 0 and 90) from a text box and rotate the triangle
about its center point for x degrees. The triangle should be
redrawn after each rotation. (8 points)
3. (Midpoint Method)
Let (0, 0) and (8, 22) be the vertices of a line segment
defined in the device coordinate system of a terminal screen.
Use Midpoint Method to tell which pixel should be plotted for
the line x=2. You must show me the results of the recurrence
formula you use in the computation process. (4 points)
************************************************************************
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.
The answer to each of Problems 1 and 2 should be the exact content of
a .java file so the grader can easily edit it and test it.