Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #5358
| From | Heike Gramberg <heike.gramberg@gmail.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Simple fractal |
| Date | 2011-10-04 05:36 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <j6e60e$kce$1@smc.vnet.net> (permalink) |
| References | <201110020636.CAA28033@smc.vnet.net> |
You could do something like this:
Manipulate[
Module[{pts = N@Table[{Cos[i*360./sides*Degree],
Sin[i*360./sides*Degree]}, {i, sides}]},
Graphics[{FaceForm[Opacity[0]], EdgeForm[Black],
NestList[ Translate[Scale[#, scale, {0, 0}], dist pts] &,
{Polygon[pts]}, depth]}]],
{{sides, 3}, Range[3, 6]},
{{scale, 0.5}, 0, 1},
{{dist, 1}, 0, 2},
{{depth, 2}, Range[7]}]
Heike
On 2 Oct 2011, at 08:36, Tom De Vries wrote:
> I am trying to create a very simple fractal, but I am not having any success.
>
> I'd like to learn how to do this recursively, and hoping someone can
> give me a bit of a push in the right direction.
>
> It's a simple triangle with triangles at each corner, with triangles
> at each corner, etc.
>
> Below, a simple "level 1" graphic.
>
> scale = 0.5;
>
> list1 = Table[{0, 0} + {Cos[i*120*Degree], Sin[i*120*Degree]}, {i,
1,
> sides + 1}];
>
> list2 = (Table[#1 + scale*{Cos[i*120*Degree], Sin[i*120*Degree]},
{i,
> 1, sides + 1}] & ) /@ list1;
>
> Graphics[{Line[list1], Line[list2]}]
>
>
> Ideally I'd like to have a Manipulate with a slider for the level of
> the fractal, the scale applied to each level, and the distance each
> corner triangle is from the centre triangle.
>
> Sorry, I know this is simple programming, but I don't have any ideas
> how to start.
>
> Tom De Vries
>
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread
Re: Simple fractal Heike Gramberg <heike.gramberg@gmail.com> - 2011-10-04 05:36 +0000
csiph-web