Dig Trig
Box Fractal
Menu
Box Fractal
In mathematics, a self-similar object is exactly or approximately similar to a part of itself (i.e. the whole has the same shape as one or more of the parts). Self-similarity is a typical property of fractals. The Sierpiński Triangle, also called the Sierpiński Gasket or the Sierpiński Sieve, is a fractal named after the Polish mathematician Wacław Sierpiński who described it in 1915. Originally constructed as a curve, this is one of the basic examples of self-similar sets, i.e. it is a mathematically generated pattern that can be reproducible at any magnification or reduction. The Box Fractal uses four cornered squares (the Hexaflake uses half of these), rather than the centered square of the Sierpiński Carpet, but the self-similar behavior is identical.

Using viral object-oriented programming (objects that create copies of themselves), self-similar objects are trivial to produce.

The following code creates an object, a square region, that then fills the four corners, each 1/3 its height and width, and then creates self-similar objects in the other 5 sections around the center. Having the same logic, or viral programming, they do the same... and so on. I've slowed the output so the process can be seen...