Drawing the Pythagoras Tree
The basics of this recursive drawing are, that there is only 1 function for drawing. This function draws something and in the end it calls itself again, it draws something and calls itself again, draws something, calls itself, … It just cycles how many times we want. And every single time witch parameters changed a bit (or a lot).
Here: Function drawTree calls function drawBranch twice. And both drawBranch functions then call the drawTree function again (with depth — 1 to be able to stop the cycling).
There is a million examples of drawing the Pythagoras tree on the internet, but I wanted to figure it out myself, so… The code may be not the prettiest, but it’s mine :)
Live version: http://studio.romanbartos.cz/Test%202/