

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!


[Programming Assignment 3; Due March 16 in class.]
Write a recursive program to draw two different “fractal images”. One should be as shown in KochTest.ps (see course web page). The other should show your creativity. Both your programs should have at least one recursive method and a main program that calls this recursive method. The output of the program is a postscript file that you can view and print using ghostview on Linux or on Windows. Postscript is a page description programming language that gives you printable graphics and text. Ghostview, which is available free of charge through a link from your course homepage, can be used to view postscript files. If the postscript file is viewed using a text editor, then you can look at the program that caused the pictorial output. Further information on the Postscript language can be obtained from a link from your course homepage. For the Koch image, the recursive method is parameterized by Depth and BaseLength. When Depth equals 1, and BaseLength equals 729, it must output the postscript code in Koch1.ps (available from the course web page). When Depth equals 2, and BaseLength equals 729, it must output the postscript code in Koch2.ps (available from the course web page).
What to submit: As usual, submit the source code for your program and the output of Javadoc. Your floppy diskette should contain all the requisite .java, .class, .html, .dat, .out files that are relevant for the grader to check the program. Make sure that the hard copy you submit is the same as the copy on the floppy, and is compilable from the floppy. For the Koch image, you should test the program for several different values of Depth and BaseLength. However, submit the postscript code for Depth equal to 3 and BaseLength = 729. Also submit the postscript pictures (not the code) for BaseLength = 729 and Depth equal to 3, 4, 5, and 6. Finally, submit the postscript pictures for the second image of your choice. Also submit your Java code for the generating the second image. Note that postscript programs allow for defining procedures and also for the use of recursion. The postscript code output by your program may use procedures. An example of such an output is shown in Koch3Procedures.ps. The postscript code output by your program may not use recursion. Thus the postscript code produced by your program should look different from that of the code in KochTest.ps, even though the picture resulting from both programs should be identical.
Extensions for the bored You can find many other examples of fractal images on your course web page. This is a problem where you can let your imagination run wild. I challenge you to be creative. Try generating other fractal images. Any imaginative or “cool” images will earn you extra credit. Your program should have appropriate comments describing whatever modifications, additions, and/or improvements you make. Here are some suggestions: