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 Hexaflake uses two diagonally cornered squares, rather than the four cornered squares of the Box Fractal, 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 two of the four corners (diagonal from each other), each 1/3 its height and width, and then creates self-similar objects in the other 7 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...