wu :: forums
« wu :: forums - Trimming trees for fractal fun »

Welcome, Guest. Please Login or Register.
May 5th, 2024, 6:29am

RIDDLES SITE WRITE MATH! Home Home Help Help Search Search Members Members Login Login Register Register
   wu :: forums
   riddles
   putnam exam (pure math)
(Moderators: Eigenray, Grimbal, SMQ, towr, william wu, Icarus)
   Trimming trees for fractal fun
« Previous topic | Next topic »
Pages: 1  Reply Reply Notify of replies Notify of replies Send Topic Send Topic Print Print
   Author  Topic: Trimming trees for fractal fun  (Read 771 times)
ecoist
Senior Riddler
****





   


Gender: male
Posts: 405
Trimming trees for fractal fun   srpfrc.jpg
« on: Apr 8th, 2007, 10:37am »
Quote Quote Modify Modify

Sierpinski's Triangle is generated by dissecting an equilateral triangle into four congruent equilateral triangles.  Then the center part is removed, the remaining three parts dissected, the center triangle of each part removed, the remaining 9 parts dissected, the center parts of each part removed, and so on, ad infinitum.
 
What if a corner part is removed as above?  You get
 
[img][/img]
Or, instead of removing parts, you change the color of parts?  I've experimented with this idea of massaging the Sierpinski Triangle trick and obtained some nice looking fractals (and designs).  Has anyone else played with this idea?
IP Logged

towr
wu::riddles Moderator
Uberpuzzler
*****



Some people are average, some are just mean.

   


Gender: male
Posts: 13730
Re: Trimming trees for fractal fun  
« Reply #1 on: Apr 8th, 2007, 10:49am »
Quote Quote Modify Modify

I played around with other shapes than triangles a bit.. And various scaling factors. Nothing noteworthy though..
IP Logged

Wikipedia, Google, Mathworld, Integer sequence DB
ecoist
Senior Riddler
****





   


Gender: male
Posts: 405
Re: Trimming trees for fractal fun   srpclr.jpg
« Reply #2 on: Apr 8th, 2007, 10:57am »
Quote Quote Modify Modify

Thanks, towr.  Looking for inspiration from you guys.  Here's one with color.
 
[img][/img]
IP Logged

ecoist
Senior Riddler
****





   


Gender: male
Posts: 405
Re: Trimming trees for fractal fun   srpfrc1.jpg
« Reply #3 on: Apr 12th, 2007, 3:10pm »
Quote Quote Modify Modify

Found another one!  Looks like a shaggy dog.
 
towr, I've tried other shapes too, isosceles right triangle, self-similar in two parts, and a 30-60-90 degree triangle, self-similar in three parts.[img][/img]
IP Logged

towr
wu::riddles Moderator
Uberpuzzler
*****



Some people are average, some are just mean.

   


Gender: male
Posts: 13730
Re: Trimming trees for fractal fun  
« Reply #4 on: Apr 12th, 2007, 3:34pm »
Quote Quote Modify Modify

Well, any triangle is just an affine transformation of the regular one. It doesn't really change the end result much.  
 
http://math.bu.edu/DYSYS/applets/fractalina.html has a nice applet to make fractals starting from any given set of points.
IP Logged

Wikipedia, Google, Mathworld, Integer sequence DB
ecoist
Senior Riddler
****





   


Gender: male
Posts: 405
Re: Trimming trees for fractal fun  
« Reply #5 on: Apr 12th, 2007, 5:30pm »
Quote Quote Modify Modify

My experience is limited but it tells me that Iterated Function Systems (IFS) are powerful enough to reproduce virtually any fractal, but they lack the simplicity of fractals produced by punching holes in self-similar figures (the original construction of Sierpinski's Triangle).  This simplicity comes at a cost, because self-similarity is not preserved by affine transformations.  Also, this simplicity both eases the creation of fractals and increases the challenge in creating "organic" fractals.
IP Logged
ecoist
Senior Riddler
****





   


Gender: male
Posts: 405
Re: Trimming trees for fractal fun  
« Reply #6 on: Apr 15th, 2007, 11:58am »
Quote Quote Modify Modify

Here's the program that created all the pictures.  The data in the two arrays, fsm and clr, determine what picture is drawn.  The data exhibited below defines a new picture reminiscent of Escher designs.
 
option angle degrees
FOR i=0 to 215
    LET r=mod(i,6)/5
    LET q=int(i/6)
    LET g=mod(q,6)/5
    LET b=int(q/6)/5
    SET COLOR MIX (i+16) r,g,b
NEXT i
let c=1/2
dim fsm(0 to 3,0 to 9)
for i=0 to 3
for j=0 to 9
read fsm(i,j)
next j
next i
data 1,0,2,3,4,0,6,7,8,9
! Finite state mschine array
data 0,2,2,3,4,0,6,7,8,9
data 0,0,2,3,4,0,6,7,8,9
data 0,3,2,3,4,6,6,7,8,9
dim clr(0 to 9)
for i=0 to 9
read clr(i)
next i
data 0,0,43,43,43,0,45,14,30,11
! Colors assigned to states of fsm
dim tree(0 to 80)
dim state(40,4)
 
!  Program
set window 0,4,0,3
do
print"Number of iterations.";
input depth
if depth<0 then exit do
clear
let level=1
let lvl=1
let tree(lvl)=0
let sc=2.8
let x=.4
let y=.1
let trn=30
call sierpnsk(depth)
loop
 
!     subroutines
sub word(a)
! Subroutine which associates position in
 
let f=tree(lvl)
! recursion tree with fsm state.  In short,
let lvl=lvl+1
! identifies the "holes".
let tree(lvl)=fsm(a,f)
end sub
sub scale(b)
let sc=sc*b
end sub
sub turn(a)
let trn=trn+a
end sub
sub draw(s)    !draw a line forward
let dx=sc*s*cos(trn)
let dy=sc*s*sin(trn)
plot x,y;x+dx,y+dy
let x=x+dx
let y=y+dy
end sub
sub move(s)    !move forward
let dx=sc*s*cos(trn)
let dy=sc*s*sin(trn)
let x=x+dx
let y=y+dy
end sub
sub push    !save the graphics state
let state(level,1)=sc
let state(level,2)=x
let state(level,3)=y
let state(level,4)=trn
let level=level+1
end sub
sub pop   !restore the graphics state
let level=level-1
let sc=state(level,1)
let x=state(level,2)
let y=state(level,3)
let trn=state(level,4)
end sub
sub sierpnsk(depth)    !recursively draw triangle fill
if depth=1 then
set color clr(tree(lvl))  
call draw(1)
else
call scale(c)
call word(0)
call sierpnsk(depth-1)
let lvl=lvl-1
call move(1)
call push
call turn(-120)
call word(1)
call sierpnsk(depth-1)
let lvl=lvl-1
call pop
call push
call turn(180)
call word(2)
call sierpnsk(depth-1)
let lvl=lvl-1
call pop
call push
call turn(120)
call word(3)
call sierpnsk(depth-1)
let lvl=lvl-1
call pop
call scale(1/c)
end if
end sub
 
end
 
IP Logged
Pages: 1  Reply Reply Notify of replies Notify of replies Send Topic Send Topic Print Print

« Previous topic | Next topic »

Powered by YaBB 1 Gold - SP 1.4!
Forum software copyright © 2000-2004 Yet another Bulletin Board