Assignment I

Tom Kelliher, CS 320

Due February 14 and 16, 2011, at the start of class.

Problems 1-3 are due on the 14th. Problem 4 is due the 16th.

  1. (15 pts.) Problem 1.4. Your proof should consist of an algorithm that takes as parameters:
    1. The x and y coordinates of the two endpoints of the line segment.
    2. MinX, MaxX, MinY, and MaxY describing the left, right, bottom, and top edges of the clipping rectangle, respectively.
    Your algorithm should return ``Not clipped,'' ``Partially clipped,'' or ``Totally clipped.''

    Include an explanation describing how your algorithm works.

  2. (5 pts.) Problem 1.7.

  3. (5 pts.) Problem 1.8

  4. (25 pts.) Problem 2.1. Use the tetra.c program on the class home page as your starting point. In addition to modifying the program by perturbing the segment midpoints, also make these modifications:
    1. The program, as is, will always perform four subdivisions. Modify it so that it interactively asks the user for the number of subdivisions to perform.
    2. The colors chosen certainly won't give much realism to the fractal mountain. Modify the color scheme to add more realism. The shade of green rendered should be a function of ``altitude'' -- darker green at lower altitudes, smoothly transitioning to lighter green at higher altitudes, and ending with a white-capped peak (or peaks). Can you transition to a brown or gray before transitioning to white?
    The goal here is to achieve as realistic-looking a mountain as possible, subject to the constraint that we're working in 2-D graphics. Be sure to include a description of all modifications you make to the program.

    Email your source code to me by the start of class on the 16th.



Thomas P. Kelliher 2011-02-06
Tom Kelliher