Menger Sponge

You can drag the object with the mouse or give it a kick . Turn around a closer approximation to the Menger sponge .
Using the LiveGraphics3D Java applet. It is based on Mathematica 3DGraphics. The Mathematica code which produced part of this HTML document is the following:
Menger[0,{i_,j_,k_}]:={Cuboid[{i,j,k}]};
Menger[n_,{i_,j_,k_}]:=Module[{s={}},Do[If[Not[u==v==2 || v==w==2 || u==w==2],
 s=Union[s,Menger[n-1,3^(n-1)*{u,v,w}+{i,j,k}]]],{u,3},{v,3},{w,3}];s];
Menger[1,{0,0,0}]
© Mathematik.com, 1999