Re: Sierpinski's thing

• To: mathgroup at smc.vnet.net
• Subject: [mg76856] Re: Sierpinski's thing
• From: Szabolcs <szhorvat at gmail.com>
• Date: Mon, 28 May 2007 05:10:22 -0400 (EDT)
• Organization: University of Bergen
• References: <200705260818.EAA18247@smc.vnet.net> <f3bh3b\$38c\$1@smc.vnet.net> <f3dp06\$fpo\$1@smc.vnet.net>

```Anolethron wrote:
> But how do you generalize it to a menger sponge?
>
>
>

??? That's very starightforward

In[3]:= pieces =
Complement[
Flatten[Table[{i, j, k}, {i, 0, 2}, {j, 0, 2}, {k, 0, 2}],
2], {{1, 1, 1}, {0, 1, 1}, {2, 1, 1}, {1, 0, 1}, {1, 2, 1}, {1, 1,
0}, {1, 1, 2},}]

Out[3]= {{0, 0, 0}, {0, 0, 1}, {0, 0, 2}, {0, 1, 0}, {0, 1, 2}, {0, 2,
0}, {0, 2, 1}, {0, 2, 2}, {1, 0, 0}, {1, 0, 2}, {1, 2, 0}, {1, 2,
2}, {2, 0, 0}, {2, 0, 1}, {2, 0, 2}, {2, 1, 0}, {2, 1, 2}, {2, 2,
0}, {2, 2, 1}, {2, 2, 2}}

In[4]:= menger[cornerPt_, sideLen_, n_] :=
menger[cornerPt + #1*(sideLen/3), sideLen/3, n - 1] & /@ pieces

In[5]:= menger[cornerPt_, sideLen_, 0] :=
Cuboid[cornerPt, cornerPt + sideLen*{1, 1, 1}]

In[9]:= Graphics3D[menger[{0, 0, 0}, 1, 3]]

```

• Prev by Date: Re: Simplifying expressions containing Bessel functions?
• Next by Date: Re: Simplifying expressions containing Bessel functions?
• Previous by thread: Re: Sierpinski's thing
• Next by thread: Re: Sierpinski's thing