Homework 3

For this assignment, we implemented a scanline fill for polygons, circles, and ellipses.

Tasks

  1. Task one was to implement the scanline fill algorithm for polygons. We used the code from the Hearn & Baker website, and modified it to fit our graphics environment and to compensate for corner-based coordinates as opposed to center-based coordinates.
  2. Task two was to implement a scanline fill for circles and ellipses. We accomplished this by filling four lines for every circle point created.
  3. Task three was to implement Polyline(). Polyline just plays connect the dots with the points it's given.
  4. Task four was to create a cube on a table with filled polygons. For two of our extensions, we added gradient fills and bitmap fills, so I did the gaudy wallpaper with bitmap fills, and the box and table legs with gradient fills.
  5. Task 5 was to create a required image with corners at coordinates
         (30, 30)
         (80, 40)
         (50, 60)
         (80, 80)
         (50, 80)
         (40, 70)
         (30, 80)
    
  6. Task 6 was to create two portfolio images.

    I call this one "Used Car Salesman". The sportcoat is a "plaid" created by a bitmap fill. The bumper and windows use a gradient fill. The pavement is a bunch of dots of random colors close to gray. The grass is random lines of random gree colors. The clouds are random circles of colors close to white. I appologize for it being a jpeg. I set it to no compression, but there are still artifacts. There were too many colors for a gif.
  7. Our extensions are described below in the questions section.

Questions

  1. Who did you work with on this assignment, and what tasks did each of you do?
    I worked with Stephanie Wojtkowski, and we did everything together.
  2. Is your polygon algorithm consistent with respect to screen coordinate issues, and does it produce rectangles that are the correct area?
    Yes, indeedily doodily. All vertices are at corner coordinates rather than centered coordinates, and the areas of rectangles are correct.
  3. How many filled polygons of a reasonable (400 pixels < area < 1000 pixels) size and complexity (5-7 edges) can your algorithm draw in 1 second?
    On Rosemary in the Sun Lab (440 MHz), it drew about 950 filled polygons per second.
  4. How many filled circles of a reasonable size (10 pixels < r < 20 pixels) can your algorithm draw in 1 second?
    We modified the testbench program to draw filled circles instead, and we got about 3100-3200 circles per second on Bay in the Sun Lab (440 MHz).
  5. If you extended this assignment in any way, describe what you did and how you did it. Include pictures, or links to pictures that show what you did.
    For our extensions, we did gradient fill and bitmap fill.
    For the gradient fill, we added two arguments to the polyFill function to make gPolyFill. The two arguments were the starting color and the ending color. The program then determines the width of the polygon and shades it with a straight-line fit from left to right so that the leftmost pixel is the first color, and the right most pixel is the second color.
    For the bitmap fill, we added an 8x8 bitmap to the arguments of polyFill to make bPolyFill. The fill pattern is based on the absolute location (x%8 and y%8).