CS 351: Assignment #2


Due midnight 22 September 2011

The purpose of this assignment is to get you building and using useful data structures, like an Image and a Pixel. The first task will be to create Mandelbrot and Julia sets, which are visually interesting and let you test out your basic classes. The second task is to implement some type of fractal noise function, such as Perlin noise. There are a number of algorithms you can use, and you can develop one yourself if you wish. The final task is to use your code from the first assignment to create composite images that integrates all of the different types of images you have created.

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.

Image Structure

Your first task is to create an Image structure. 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 cb_mage.h, and put all of the code in a file called image.c.

While we will be doing all of our coding in C, we will be following an object-oriented style of design.

The required data and functions/methods for the Image structure are given in the C system specifications. If your code follows the specification, you will be able to compile test program 1. In addition to the image below, the program should make a black image and a sky blue image.

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, respectively.

Write two programs that let the user create a Mandelbrot or a Julia set. The program should take as input a rectangle on the complex plane and the number of rows in the output image. The program should then write out a PPM image of the visualization.

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 other images for your portfolio. Experiment with coloring methods.

To test your system, you can run the following test program. It should create something like the image below, depending upon how you chose to color your Mandelbrot set.

Fractal Noise

Implement some form of fractal noise, procedural texture, or a visualization of some mathematical expression mapped onto a 2D plane. Perlin noise, for example, is often used for creating realistic textures like fog, fire, and dust. This part of the assignment is pretty open, and you can create your own function if you wish. Just make some kind of interesting visual texture.

Create a function in your image library that takes an existing image structure and fills it with your procedural noise/texture. You can choose what other parameters are appropriate for your function.

The required image for this task is a picture showing your noise/math function. In addition, create at least two more images for your portfolio.


Create an image that is a composite of a Mandelbrot or Julia set and at least one other image. As part of the composition, use your fractal noise as either one of the images or as the alpha mask (or both). This part of the assignment doesn't require you to write any more code. Make use of the programs you've already written.

Create at least two more images for your portfolio.


  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 fractal noise effects.
  5. Develop more interesting compositions.


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.


Put your code files in your handin folder. Put your writeup on the wiki. Give it the label cs351f11project2.