Lab 9
Page 4


Creating your own Design

Create your own free form recursive design. In addition to the lines mentioned above we have also provided you with ways to draw solid rectangles, circles, and line rectangles, and with a way to rotate the smaller versions of your picture.

To get started download MyPicture.java, it is essentially the same as the HTree template we gave you earlier. Again you will be modifying only the draw() method.

In the H-tree exercise we told you how to draw lines. You may also draw other things using these commands:

The variable names "CenterX", "CenterY", etc., are not predefined. These are just names given to illustrate the example. You should replace these by what you want there instead.

We also showed you how to use nextColor to change the color for different levels of recursion. You can use nextColor in several other ways to achieve interesting effects. You can also use another method we provided called randomColor() to get a random color.

Another very interesting thing to explore is having the smaller drawings be rotated versions of the larger ones. To achieve this effect give the Angle parameter to the new calls a value other than 0. To have each smaller version rotated slightly more than the big version that generated it use something like currentAngle + (Insert your favorite integer) this will make each smaller version rotated that many more degrees than the larger version that generated it.

Please do NOT just make some trivial change to your H-tree such as removing the center line. We would like to see something as different from the H-tree as possible.

Use a separate HTML file to view this applet. In the HTML file, include a short description of what you did. That file should also contain a link to your MyPicture.java file (linking the file as a text file). Extra credit will be given to designs that are particularly beautiful or unusual or interesting, or show their recursive nature particularly well.


PREVIOUS 1 | 2 | 3 | 4 | 5 NEXT