MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Sierpinski's thing


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