[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

LOGO-L> Re: fractals



Here is a coloured version of penrose tiling using np and rp.
Use 'procs' to edit
------
to aaa
; try penrose 120 4
; 'large' and 'small' are the penrose rhombs
; 'pent' is the initial design
; but can be any design involving the rhombs (large, small).
; Use 'large :size :level' and then 'small :size :level' 
; with :level=1 then 2
; to see the recursion links.
end

to large :l :n
if :n=0 [pu stop]
if :n=1 [pd]
fd :l lt 2*:ang
np
lt :ang small :l/:tau :n-1
rp
fd :l lt 3*:ang
np
lt :ang large :l/:tau :n-1 
rt 2*:ang large :l/:tau :n-1
rp
fd :l
np
small :l/:tau :n-1 rt :ang bk :l/:tau
lt :ang large :l/:tau :n-1
rp
lt 2*:ang
fd :l lt 3*:ang
pu
if :n=1 [np lt 20 fd 5 setfc [255 0 0] fill rp]
end

to penrose :size :level
cs 
ht pu
setpc [0 0 0] 
localmake "ang 36
localmake "tau (1+sqrt 5)/2
bk :size*:tau
rt 2*:ang
;small :size :level
;large :size :level
pent :size :level
end

to pent :l :n
if :n=0 [pu stop]
;; draw central pattern
repeat 5 [lt :ang large :l :n rt :ang
fd :l lt :ang fd :l lt :ang]
end

to procs
ed[aaa penrose pent large small]
end

to small :l :n
if :n=0 [pu stop]
if :n=1 [pd]
np
rt :ang large :l/:tau :n-1
np 
lt 3*:ang fd :l/:tau rt 180 
small :l/:tau :n-1 
rt 4*:ang small :l/:tau :n-1
rp
lt 4*:ang large :l/:tau :n-1
rp
fd :l lt 4*:ang fd :l lt :ang 
fd :l lt 4*:ang fd :l lt :ang
pu
if :n=1 [np lt 20 fd 5 setfc [0 255 0] fill rp]
end


penrose.GIF



Global SchoolNet Foundation - Linking Kids Around the World!
Copyright GSN - All Rights Reserved - Comments & Questions
Visit GSN's Global Schoolhouse for more exciting learning resources!
Search our Site - Home