Project 3: Recursive Graphics
Started: Tuesday 3/1; Due: Friday 3/4, by the beginning of class
Overview
In this project you will do several programs that draw fractal patterns.
You should work on this project individually.
Specific tasks
-
To start out, create "Project3" folder and copy the
CCurve.javafile into it, and then compile and run it with several different argument values to be sure you fully understand how it works. Notice that if you interchange(x0, y0)with(x1, y1)you don't get the same image (providedlevel>0). That is because the c-curve depends on the direction from the first point to the second, which is to say that a c-curve has an orientation.
Your first programming task is to write a new program inDragon.javathat does the same thing asCCurveexcept that forlevel>0, is switches the order (orientation) on the second half of the sub-curve. You should get something radically different from the c-curve; be sure you check with the lab instructor that you did the right thing. -
Next, create a new class called
Sierpinskithat will eventually be used to draw a Sierpinski gasket, as described in class. First, however, you will want to write a public static method calledtrianglethat takes six double argumentsx0 y0 x1 y1 x2 y2and draws the triangle between the points(x0, y0),(x1, y1), and(x2, y2). Do this, testing the procedure fully. Be sure to try triangles that aren't equilateral. -
Now write a public static method called
sierpinskiwhich takes six double argumentsx0 y0 x1 y1 x2 y2and anintargumentleveland draws the Sierpinski of the given level through the given points. Again, test the procedure fully, being sure to test with points that do not form an equilateral triangle. You should see the following images with the given arguments:Sierpinski 0 0 1 0 .5 .866 0Sierpinski 0 0 1 0 .5 .866 1Sierpinski 0 0 1 0 .5 .866 2


Sierpinski 0 0 1 0 .5 .866 3Sierpinski 0 0 1 0 .5 .866 4Sierpinski 0 0 1 0 .5 .866 5


-
Finally, come up with your own fractal pattern. I will discuss some possible ideas in class. Otherwise, you could play around with the program
IFS.javato see some other self-similar fractals. For your convenience, following are the input files that they refer to at the top of the files:
What you must hand in
The whole project, of course which should include the two classes Dragon.java and Sierpinski.java, as well as the class
that implements the fractal you create in part 4 above. You must also fill out the following readme.txt file.
Gradesheet
We will use this gradesheet when grading your lab.
Submission
Use the procedure described in our instructions on submitting code document.