aUCBLogo Demos and Tests / fractal_tiling
to fractal_tiling
ct cs ht setpensize 0.3
updategraph
setFillTolerance 0.3
; disableLineSmooth
;setfc rgb 1 1 0
setpc rgb 0 0 0
backc=rgb 1 1 1
let[[size 200]
[f (sqrt (4-2*sqrt 2))/2]
[n0 10]]
pu bk :size/2
localmake "k0 1
tile n0 :size (list (list pos Heading))
make "k0 -1
home pu bk :size/2
tile n0 :size (list (list pos Heading))
end
to tile :n :size :list1 [:k :k0][:list2 []]
if :n==0 [stop]
setfc rgb 1 n/n0*0.95 0
if empty? :list1[(tile :n-1 :size/sqrt 2 :list2 0-:k [] ) stop]
;(show "list1 :list1)
local [posn posn1] make "posn first :list1
pu setpos first :posn seth last :posn
;comment[
make "posn1 list pos heading
rt :k*22.5 fd :size*:f
if or not pixel == rgb 1 1 1 (signum xcor) == 0-:k0
[setpos first :posn1 seth last :posn1
(tile :n :size bf :list1 :k :list2 ) stop]
setpos first :posn1 seth last :posn1
;]
; Tesselation
; [
pd fd :size rt :k*135
make "list2 fput list pos heading :list2
fd :size/sqrt 2 rt :k*90
make "list2 fput list pos heading :list2
fd :size/sqrt 2 rt :k*135
; ]
pu
rt :k*22.5 fd :size*:f
; setfc HSB 360*:n/10 1 1
; setpc backc
; fill
; (fill FILL_SURFACE)
; (fill FILL_SMALL)
; (fill FILL_SMALL_SURFACE)
(fill FILL_SMALL_TOLERANT)
; (fill FILL_SMALL_SURFACE_TOLERANT)
;setpc 0
; updategraph
(tile :n :size bf :list1 :k :list2 )
end