The Tree Factal

The Tree Fractal is more complicated than the Sierpinski or the H-Tree fractals. You begin by drawing a 'trunk' for the tree. In the next step, you draw 'branches' (which are 'trunks' of smaller trees) (Figure 1). The length of each branch is a proportion of the length of the trunk (like 0.8 * trunklength). The initial trunk is at an angle with the horizontal axis (angle1) and each branch angle differs from the previous trunk angle by a constant amount (angle2). Figure 2 illustrates this. Continue drawing 'trunks' until a specific number of iterations are completed. To get the green 'leaves', draw a small green circle at the last iteration.

Figure 1
Figure 2
Figure 3

To draw the Tree fractal, you need these things:

So overall, the signature for your recursive method might look like this:

public void drawTree(int x, int y, double trunkAngle, double splitAngle, int length, int iterations, double ratio)