CS335 Fall, 2008 Programming Assignment 3 (40 points) (Team project: two people a team) Due: December 11 (Thursday) 1. Problem Description In this assignment you are required again to form a team with a classmate and jointly develop java tools that allow a user to perform 2D animation of a 2D polygon and the associated Bezier curve on screen. A new menu item called
should be added to your menu list for Prog2 so that once a polygon is input, the user can click in this area to start the animation of the polygon and the associated Bezier curve. 2. Implementation Details For a given polygon, we can create a closed composite Bezier curve in two steps: (1) compute mid-point of each edge of the polygon; (2) for each vertex of the polygon, construct a Bezier curve of degree two using the vertex and mid-points of the adjacent edges as control points.
For instance, in (a) of the above figure, D is the mid-point of the edge AB and E is the mid-point of the edge BC. The Bezier curve segment defined by the mid-points D and E and the polygon vertex B is shown in (b). The equation of such a curve is shown below.
When the "Animated 2D bouncing" menu item is clicked by the user, your program should construct a closed, composite Bezier curve of degree two for the given polygon using the above approach first. With a pre-set velocity (direction and speed) and a rotation speed about its centroid (of the polygon), your program should then move and rotate the polygon and the Bezier curve accordingly and bounce them in the appropriate direction when the polygon and the Bezier curve hit the wall (boundary of the canvas or your drawing area) *************************** HERE IS THE IMPORTANT PART *************************** Your program should not bounce the polygon and the Bezier curve immediately after one of the vertices touches the wall. Your program will start to bounce the polygon and the Bezier curve only when the "centroid" of the polygon hits the wall. This means that your program will need to clip the polygon against the wall periodically and update the corresponding Bezier curve accordingly. At some point, both the polygon and the associated Bezier curve might be broken into several smaller, disjoint polygons and Bezier curves. 3. What to Turn In Mail your program (in one file) and external documentation (in another file) of your team to the grader on or before the due date. Name your applet driver "Draw.java" and put it in the first (comment) line of the driver. The names of the other classes of your program are not important. Your java code must contain internal documentation. The external documentation named YourLastNames.txt should describe the project specifications and the implementation details.