Re: Simple fractal
- To: mathgroup at smc.vnet.net
- Subject: [mg121829] Re: Simple fractal
- From: Heike Gramberg <heike.gramberg at gmail.com>
- Date: Tue, 4 Oct 2011 01:31:58 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- 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 >
- References:
- Simple fractal
- From: Tom De Vries <tidetabletom@gmail.com>
- Simple fractal