Diminishing geometric figures.

Anatoly ( 'tsh73' on the Forums) suggested a fun programming task- create the diminishing black and white boxes image. It immediately suggested to me a recursive solution- step right and draw two half-squares, then repeat scaling down by two each time.

I tried it, got carried replacing the squares with circles, and made animations of the process for display ( it's nice to watch at the higher resolutions, but takes a few seconds to complete), and finally by the challenge of creating the 'Tree of Circles. For that I experimented- at first I surrounded each circle with its children, but then implemented a way of not drawing the one that faces back to its parent- and with the spacing- whether to leave gaps or let the circles overlap.

-

This version loaded a graduated background first- could have done that programmatically but did not.


Code

Example code is in patterns.zip