…is always light

# Tag Archives: pythagorean tree

## Pythagorean Tree

Many, many years ago I came up with an idea about a fractal that would be based on right triangles and squares. People that had less mathematical experience than I, didn’t take me seriously, when I told about my idea. They thought that this was just some kind of nonsense.

I didn’t visualize my idea and forgot the whole thing… Later, after many years when I started to read e-books about fractals, I found sophisticated ideas how to make nice colored Pythagorean fractal trees. I think I’ve been dealing with wrong people in the past… 🙂

We start with a right triangle with two 45 degrees angles and one 90 degrees angle and visually speaking turn the triangle so that hypotenuse is at the bottom:

Next we draw squares against the sides of the triangle so that the length of the side of the square is the length of the side of the triangle:

Next we imagine new right triangles to the farthest side of the ”branch” squares and do the same process as earlier: We draw squares to all the sides of the triangles.

This process is continued infinitely and we have a fractal! …that looks like a tree.

The length of the new hypotenuse c‘ = cos(45°) * c, where c is the length of the hypotenuse of previous iteration loop’s right triangle(s).

When generating the tree, I recommend using Java with JavaFX package or using JavaScript, because with those one can use the following methods:

• beginPath
• translate
• rotate
• save
• restore

These methods make it quite easy to generate a fractal tree. When drawing the tree into screen, only the squares are drawn.

The e-book below discusses lots of fractal programming and has also an example codes in JavaScript generating these kinds of trees (also colored):