j-orlin-grabbe

Sierpinski Carpet Fractal

Java Applet No Longer Supported

This content originally displayed an interactive Java applet that generated a Sierpinski carpet fractal. Java applets are no longer supported in modern browsers for security reasons.


This applet generates a Sierpinski carpet. If you look at the Java source code you will see that it generates a random number, and then with probability 1/8 does the following:

  • divides the current (x,y) value by 3,
  • and may also add either 1/3 or 2/3 to x, or to y, or to both.

The key omission, in order to create the Sierpinski carpet holes, is that zero probability is assigned to the possibility

Xnew = X/3 + .3333333333333333;
Ynew = Y/3 + .3333333333333333;
This omission creates a hole at each smaller level of the carpet.

Here is the java source code.