skip to content
Fulldroper`s personal site

Sierpinski Triangle

/ 2 min read

Last Updated:

The purpose of the project was to recreate the Sierpinski Triangle fractal and gain skills in simulating physical processes. It also serves as an example for visualization, which can be viewed here.

The project is useful for understanding the mathematical properties of fractals and their visual representation. It provides a hands-on approach to learning about recursion and graphical rendering in JavaScript.

How the project works

The project involves generating the Sierpinski Triangle fractal using recursive algorithms. Each iteration subdivides a triangle into smaller triangles, creating a self-similar pattern. The project uses JavaScript to render the fractal on a web page.

You can find the repository and installation instructions at the following link: Sierpinski Triangle

Sierpiński triangle

The Sierpiński triangle, also called the Sierpiński gasket or Sierpiński sieve, is a fractal attractive fixed set with the overall shape of an equilateral triangle, subdivided recursively into smaller equilateral triangles. Originally constructed as a curve, this is one of the basic examples of self-similar sets—that is, it is a mathematically generated pattern that is reproducible at any magnification or reduction. It is named after the Polish mathematician Wacław Sierpiński, but appeared as a decorative pattern many centuries before the work of Sierpiński.

The Sierpinski triangle may be constructed from an equilateral triangle by repeated removal of triangular subsets:

  1. Start with an equilateral triangle.
  2. Subdivide it into four smaller congruent equilateral triangles and remove the central triangle.
  3. Repeat step 2 with each of the remaining smaller triangles infinitely.

An example of the result of the algorithm

Sierpiński Triangle

try it on codepen.io.

References

  1. Conversano, Elisa; Tedeschini-Lalli, Laura (2011), “Sierpinski Triangles in Stone on Medieval Floors in Rome” (PDF), APLIMAT Journal of Applied Mathematics, 4: 114, 122

  2. Brunori, Paola; Magrone, Paola; Lalli, Laura Tedeschini (2018-07-07), “Imperial Porphiry and Golden Leaf: Sierpinski Triangle in a Medieval Roman Cloister”, Advances in Intelligent Systems and Computing, Springer International Publishing, pp. 595–609,

  3. “Sierpinski Gasket by Trema Removal”

  4. Michael Barnsley; et al. (2003), “V-variable fractals and superfractals”, arXiv:math/0312314

  5. Peitgen, Heinz-Otto; Jürgens, Hartmut; Saupe, Dietmar; Maletsky, Evan; Perciante, Terry; and Yunker, Lee (1991). Fractals for the Classroom: Strategic Activities Volume One, p.39. Springer-Verlag, New York. ISBN 0-387-97346-X and ISBN 3-540-97346-X.

Skills Acquired

  • Advanced JavaScript programming
  • Understanding fractal geometry
  • Implementing recursive algorithms
  • Rendering graphics on a web page using the Canvas API