CS 351: Assignment #2

Fractals

Due 18 September 2014

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 integrate all of the different types of images you have created.


Image Structure

Your first task is to create an Image data 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 Image.h, and put all of the code in a file called Image.c. (You can choose other names if you wish.)

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 an anchor on the complex plane and with width of the rectangle to render. Your function will need to compute the height of the rectangle on the complex plane given the rows and columns in the given image.

The function should fill out the Image so it contains the proper Mandelbrot or Julia set visualization. The function prototypes are below.

void mandelbrot( Image *dst, float x0, float y0, float dx);
void julia(Image *dst, float x0, float y0, float dx);

Write main 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 by calling the appropriate function..

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 class. 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. Note that you may have to edit the include file if you name your include files differently from mine.

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.

Create at least one other image for your portfolio that makes use of the texture/noise method you created for this task.


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 fractal noise effects.
  5. Develop more interesting compositions, possibly mixing the fractals and the noise in an interesting manner.

Writeup

Use your writeups as the basis for your portfolio. Treat them like an artist's description of the work. In the case of required images, give a brief description of what they show and anything unique about it that you developed.

Handin

Put a zip file of your code in compilable form in your handin directory. Put your writeup on the wiki. Give it the label cs351f14project2.