Karl Menger was an Austrian-American mathematician working on the algebra of geometries, curve and dimension theory. Menger was born in Vienna in 1902 to economist Carl Menger and novelist Hermione Andermann. His father, Carl Menger, was a founder of the Austrian school of economic thought and developed the theory of marginalism.
In 1920, Karl Menger enrolled at the University of Vienna to study Physics. After only a few months, he switched to mathematics and attended a pivotal lecture by Hans Hahn. Hahn lectured on a problem of defining the concept of a curve, at the time considered unsolvable.
Part-way through his studies, in 1921 Menger was diagnosed with tuberculosis and sent to a sanitorium in Aflenz. While he was confined in Aflenz, both his father and mother passed away. When Karl returned to University, he had developed a full theory of curves and earned his doctorate with Hahn.
Menger thought about geometry in its most fundamental sense, in a way that modern mathematicians would describe as general topology. He devised a completely new approach to Euclidean geomtry, an approach that played a significant role in John von Neumann's mathematical foundation of quantum mechanics. One of his important contributions to geometry was the discovery of a 'universal curve' in three-dimensional space. This curve has the property that every concievable curve can be embedded within it.
One constructs a Menger sponge by starting with a regular cube.
Then iteratively doing the following:
- Divide every face into nine equal squares, and subdivide the cube into 27 smaller cubes.
- Remove the smaller cube in the centre of each face.
- Remove the smaller cube from the centre of the large cube
After one iteration, we have a level-1 Menger sponge.
After two iterations, we have a level-2 Menger sponge.
After three iterations, we have a level-3 Menger sponge.
After four iterations, we have a level-4 Menger sponge.
After five iterations, we have a level-5 Menger sponge.
And so on..
The computational energy required to render this sponge increases rapidly with each iteration. The Menger sponge is the result of this process after an infinite set of iterations. The images you see above are a crude approximation of the structure.
We can calculate the surface area and volume for each iteration and see some interesting results. The surface area is calculated in multiples of the initial face area, and the volume is calculated as a percentage of the initial volume.
Iterations | Surface area | Volume |
---|---|---|
0 | 6 | 1 |
1 | 8 | 0.740740741 |
2 | 13.03703704 | 0.548696845 |
3 | 24.75720165 | 0.406442107 |
4 | 51.2702332 | 0.301068228 |
5 | 110.6042778 | 0.223013502 |
6 | 242.8276629 | 0.165195187 |
7 | 536.9862544 | 0.122366805 |
With every iteration, the surface area rapidly shoots up, while the volume rapidly decreases. After an infinite number of iterations, the Menger sponge has an infinite surface area and also zero volume.
POV-Ray code
The first few iterations of the Menger sponge can be rendered in the raytracing software POV-Ray. You can see the complete code on GitHub here.
As with the construction above, we begin with a simple cube
box { <0, 0, 0> <1,1,1> }
We then need a method to generate the structure that are going to be removed from this cube to produce the sponge
#macro voidCubes(dim) #declare y1 = (1/3)/(pow(3,dim)); #declare z1 = (1/3)/(pow(3,dim)); #declare prod1 = -0.1; #declare prod2 = 1.1; #declare psize = (1/3)/(pow(3,dim)); #while (z1<=1) #declare y1 = (1/3)/(pow(3,dim)); #while (y1<=1) box { <prod1,y1,z1> <prod2,y1+psize,z1+psize> pigment { color rgb <1,0.2,0> } } box { <y1,z1,prod1> <y1+psize,z1+psize,prod2> pigment { color rgb <1,0.2,0> } } box { <y1,prod1,z1> <y1+psize,prod2,z1+psize> pigment { color rgb <1,0.2,0> } } #declare y1=y1+pow((1/3),dim); #end #declare z1=z1+pow((1/3),dim); #end #end
This produces a series of rectangular boxes that span the area that is going to be removed, for a given dimension. To produce the void cubes for the level-1 sponge, we simply call voidCubes(0). Making a union of several dimensions produces the void cube structure for the higher level menger sponges, such as:
union { voidCubes(0) voidCubes(1) voidCubes(2) voidCubes(3) voidCubes(4) }
We can also put a light source inside the centre of the voids, just to make it look pretty. Inside the #while statement, we insert
#if (dim < 2 ) light_source { <(prod1+prod2)/2,y1,z1> color rgb <1,1,1>