MathGroup Archive 2007

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

Search the Archive

Re: Sierpinski's thing

  • To: mathgroup at smc.vnet.net
  • Subject: [mg76768] Re: [mg76685] Sierpinski's thing
  • From: "Lev Bishop" <lev.bishop+mathgroup at gmail.com>
  • Date: Sun, 27 May 2007 04:50:31 -0400 (EDT)
  • References: <200705260818.EAA18247@smc.vnet.net>

On 5/26/07, Anolethron <abacus78685 at tin.it> wrote:
> What I'm trying to do is basically constructing a Sierpinski's carpet with
> an algorithm that can be generalized to the construction of a Menger Sponge.
>

sierp[p_, d_?(# > 1 &)] := {Rectangle[p + {d, d}/3, p + 2 {d, d}/3],
   sierp[p + d #/3, d/3] & /@ {{0, 0}, {0, 1}, {0, 2}, {1, 0}, {1,
      2}, {2, 0}, {2, 1}, {2, 2}}};
sierp[p_, d_] := Rectangle[p + {d, d}/3, p + 2 {d, d}/3];
sierp[n_Integer] :=
  Graphics[{White, sierp[{0, 0}, 3^n]}, Background -> Black];

and then you can do, eg:
sierp[3] (* v6 *)
or
Show[sierp[3],AspectRatio->1] (*v5.2*)


  • Prev by Date: Antialiasing of 3D graphics
  • Next by Date: Re: Style Sheets in Version 6.0
  • Previous by thread: Sierpinski's thing
  • Next by thread: Re: Sierpinski's thing