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:
drawCircle(Color, CenterX, CenterY, Radius, true (for solid circle)
or false (for outline circle));
drawRectangle(Color, X1, Y1, X2, Y2, true (for solid)
or false (for outline));
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 |