⬆️ ⬇️

A little about the beauty of T-fractals



In 1977, Benoit Mandelbrot wrote the book The Fractal Geometry of Nature. In it, he described in detail how, guided by simple rules, to draw a complex and beautiful self-similar pattern. And before Mandelbrot, and after, and to this day, fractal patterns attract the attention of mathematicians, programmers, artists, and other beauty lovers.



There are many fractal families. Today I will talk about one of them, surprisingly easy to build it in your browser window, and beautiful enough to want to explore its properties.





')





The fractal family described here has no name of its own, but it has grown out of a T-square. It is very easy to stand a T-square, using the principles of overlaying layers described in the procadas article . We take a small square, like this, only smaller, 4px * 4px in size, and we pave them with a plane. Note that the boundary pixels of the square are transparent. Anyone who has read an article about the principle of cicadas will immediately understand why this is necessary.

Then we quadruple the square four times — two to one side — and pave the plane one more time. Repeat. Repeat. After a few iterations, the squares will become large — and their mutual overlap will form a fractal.



And what if you take not such a square-pattern and such ?

And make the visible pixels translucent, so that the layers shine through each other?



And that's what.







And with a different pattern (can you guess how?), The result will be like this:







The most interesting thing is that not every time you can predict what will come out of the pattern.



I think it will be interesting for you to set a couple of fractals yourself. Do not crash my server!



Sorry for the minimalism. By the way, if you run the source for yourself, there will be more functions.



Well, now apologize not only for minimalism, but also bad code. Everything is written in php, and you need gc to process the pictures - I think you already have it.



Discover your beautiful fractal!



PS The picture at the beginning is made like this .



PPS kumankov added a bit of color in black and white pictures.

Source: https://habr.com/ru/post/145560/



All Articles