/pythagoras-tree

Pythagoras Tree using Lindenmayer system

Primary LanguageCMIT LicenseMIT

Pythagoras Tree

Introduction

The Pythagoras tree is a plane fractal constructed from squares. Invented by the Dutch mathematics teacher Albert E. Bosman in 1942, it is named after the ancient Greek mathematician Pythagoras because each triple of touching squares encloses a right triangle, in a configuration traditionally used to depict the Pythagorean theorem. If the largest square has a size of L × L, the entire Pythagoras tree fits snugly inside a box of size 6L × 4L.

Construction

The construction of the Pythagoras tree begins with a square. Upon this square are constructed two squares, each scaled down by a linear factor of square-root(2/2), such that the corners of the squares coincide pairwise. The same procedure is then applied recursively to the two smaller squares, ad infinitum. The illustration below shows the first few iterations in the construction process

Copyright and license

Code copyright 2018 Azeem Mirza. Code released under the MIT license.