

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


COSC 231 Programming Project GUI for Two Fractals Distributed : 24 November 2009 Due : 10 December 2009 Write a GUI that will display, with certain user-controlled parameters, the Sierpinski gasket and a Mandelbrot set. Sierpinski triangle (gasket) The Sierpinski triangle generation algorithm is given in Savitch’s book (3rd^ edition) on pp 1061 - 2. That text is reproduced here. Write a program that draws a Sierpinski gasket. A Sierpinski gasket or triangle is a type of fractal. It is an example of how an orderly structure can be created as a result of random, chaotic behavior. The creation of a Sierpinski gasket is fairly simple. There are three points that form the corners of a triangle. In the figure below, they are labeled as A, B, and C. To draw the Sierpinski gasket follow the algorithm:
repeating structure: < picture from Savitch is not reproduced here. Look at http://en.wikipedia.org/wiki/Sierpinski_gasket > To draw a single pixel at coordinate (x, y) use the drawline method where the start and endpoints are both (x, y). To generate a random number x , where 0 < x < 1 , use x = Math.random();. For example, multiplying by 3 and converting to an integer results in an integer that is from 0 to 2. Mandolbrot set There are several explanations of the Mandelbrot set. A simple one, including the iterative algorithm for determining if a number is a member of the set, is given at
Here is another simple explanation:
Each point, C, in the complex plane is a member of the Mandelbrot set if after iterating (forever), the magnitude of Z is less than 2. Z iterates as follows: Z 0 = 0. Zn+1 = Zn * Zn + C Represent a point C = x + iy on the drawing surface as (x, y). The GUI Interface The GUI interface will have a drawing surface and the following buttons: