CS 351: Assignment #2

Fractals

Due midnight 16 September 2008

The purpose of this assignment is to get you thinking about how to create images from scratch. We'll also start building some basic data types that will be used over the whole semester. In part one, you'll create visualizations of Mandelbrot and Julia sets. In part two, you'll manipulate your own image and mix it with other images to achieve different effects.


Assignment Guidelines

You may work by yourself or with one other person for all of the remaining assignments. Each group (1 or 2 people) should submit a single writeup. Each person should create their own images or image variations when there is an element of creativity to it. The writeup should include the images of all group members.

To hand in your writeup you will create either a wiki page or a web page that includes pictures as well as a report. A good report will describe the algorithm at a level appropriate for an intelligent layperson (your fellow students). A really good report will read like a tutorial for the topic. All reports should begin with an abstract of what you did (200 words or less) and a picture.

If you want to hand in your report as a web page, please see the web page tutorial.

Image Structure

Your first task is to create an Image structure (C) or class (C++). The Image structure will be your internal representation of an image's attributes and data. Put all of the Image definitions in a file called Image.h, and put all of the code in a file called Image.c (C) or Image.cpp (C++).

You are free to choose C or C++ for all of your work this semester. The assignments will provide different specifications for both languages. The code will be largely identical in the inner details, but the interfaces will be slightly different. The C code will be organized in a very modular, object-like fashion.

The image structure needs to contain at least the following information.

The required data and functions/methods for the Image structure are given in the C and C++ system specifications. If your code follows the specification, you will be able to compile test program 1. Note that, for now you can leave the z-buffer field out of the Image data class.

Mandelbrot and Julia Sets

For this task you will write two functions. One will create an image of a Julia set, and one will create an image of the Mandelbrot set. Both functions should take as input floating point values indicating the min and max values in x and y on the complex plane and the height of the image to create. The function should return a new Image that contains the proper Mandelbrot or Julia set visualization.

Write a program that lets the user choose whether to render a Mandelbrot or Julia set, enter a rectangles on the complex plane, and enter the number of rows in the output image. The program should then write out a PPM image of the correct part of the set.

You can choose how to render your set. You can find lots more information and ideas at the Wikipedia entry. We'll also go over the algorithm and some rendering methods in lab. For more detail, see my lab notes.

The required images for part one are:

  1. A picture of the complete Mandelbrot set in an appropriate rectangle.
  2. A picture of a Julia set defined by c = 0.7454054 + i*0.1130063 in an appropriate rectangle.

In addition, create at least two images for your portfolio.

Blue Screen

In lab we'll take a picture of you in front of a blue screen.

  1. Write a program that reads in the image of you, turns all the blue pixels black, and writes out the result (required image 1).
  2. Write a program that reads in the image of you and another background image of the same size. The program should then output an image where the blue pixels have been replaced by the background image (required image 2).
  3. Write a program that reads in the image of you and a background image that can be a different size. Make your program insert multiple (at least 2) versions of yourself into the background image. Try shrinking, growing, rotating, mirroring, or distorting your image (required picture 3).

The blue screen images will be linked here after the lab.


Extensions

  1. Try out different methods of coloring the Mandelbrot and Julia sets.
  2. Highlight something interesting about the Mandelbrot or Julia sets.
  3. Try out some other Julia sets.
  4. Implement multiple effects for your blue screen image.
  5. Put lots of people into one image.
  6. Borrow the blue screen and make a movie of yourself flying or diving into a dinosaur's mouth.

Writeup

All writeups should suggest the format of a lab report. They do not have to be long, but need to provide enough information that I have some idea you knew what you were doing.

  1. Abstract: 200 word description (at most) of what you did and a picture to go along with it.
  2. Description of the task, in your own words. Be brief, but write it as though explaining it to a fellow student not in the course.
  3. Description of how you solved the task, including any key equations or algorithms. You should also include algorithms or descriptions of what you did for any extensions. Include pictures here.
  4. More pictures. Please put a caption on each picture explaining something about it. If you have nothing else, give it a name and indicate whose picture it is.
  5. Summary of what you learned.

Handin

Put your code files in your handin folder. Send the prof an email with the URL for your writeup (wiki or standard web page) when it's done. In either case, please edit the assignmnet handin page on the wiki so there is a link to your assignment.