aUCBLogo Demos and Tests / ifsmorph
to ifsmorph ;I_terative F_unction S_ystem
clearScreen
foreach allopen [ close ?]
setUpdateGraph false
; setScreenColor 0
WindowMode
; allFullScreen
; (splitScreen 0.9)
maxi2=16
maxi2Move=12
maxi=Int 2^maxi2
trafomode=true
palsize=256
pal=IntArray loadpalette "ifs.pal
on=1
data=
[
[dragon
{1 1} ;p=probability
{ { 0.5 -0.5 0.5 0.5 0 0}
{-0.5 -0.5 0.5 -0.5 1 0}
} ;d=Drehmatrix
300 ;sk=Skala
-100 ;x0=xorigin
0 ;y0=yorigin
1 ;cf=color factor
1 ;cf2=color factor 2
]
[LevyDragon
{1 1}
{ {0.5 -0.5 0.5 0.5 0 0 }
{0.5 0.5 -0.5 0.5 0.5 0.5}
}
300
-170
-120
1
1
]
[dragon2
{78 22}
{ {.824074 .281482 -.212346 .864198 -1.882290 -0.110607}
{.088272 .520988 -.463889 -.377778 0.785360 8.095795}
}
50 0 -250 1 1
]
[crystal
{75 25}
{ {.696970 -.481061 -.393939 -.662879 2.147003 10.310288}
{.090909 -.443182 .515152 -.094697 4.286558 2.925762}
}
50 0 -250 1 1
]
[swirl5
{9 1}
{ { .745455 -.459091 .406061 .887121 1.460279 0.691072}
{-.424242 -.065152 -.175758 -.218182 3.809567 6.741476}
}
50 0 -250 1 1
]
[zigzag2
{9 1}
{ {-.632407 -.614815 -.545370 .659259 3.840822 1.282321}
{-.036111 .444444 .210185 .037037 2.071081 8.330552}
}
50 0 -250 1 1
]
[triangle
{1 1 1}
{ {.5 0 0 .5 0 0}
{.5 0 0 .5 0 1}
{.5 0 0 .5 1 1}
}
200 -200 -200 1 1
]
[SierpinskiTriangle
{1 1 1}
{ {0.5 0 0 0.5 0 0 }
{0.5 0 0 0.5 0.5 0 }
{0.5 0 0 0.5 0.25 0.433}
}
600
-300
-260
1
1
]
[binary
{1 1 1}
{ {.5 .0 .0 .5 -2.563477 0}
{.5 .0 .0 .5 2.436544 0}
{.0 -.5 .5 .0 4.873085 7.563492}
}
40 0 -200 1 1
]
[floor
{1 1 1}
{ {.0 -.5 .5 .0 -1.732366 3.366182}
{.5 .0 .0 .5 -0.027891 5.014877}
{.0 .5 -.5 .0 1.620804 3.310401}
}
50 0 -200 1 1
]
[spiral
{90 5 5}
{ { .787879 -.424242 .242424 .859848 1.758647 1.408065}
{-.121212 .257576 .151515 .053030 -6.721654 1.377236}
{ .181818 -.136364 .090909 .181818 6.086107 1.568035}
}
40 100 -200 1 1
]
[coral
{40 15 45}
{ {.307692 -.531469 -.461538 -.293706 5.401953 8.655175}
{.307692 -.076923 .153846 -.447552 -1.295248 4.152990}
{.000000 .545455 .692308 -.195804 -4.893637 7.269794}
}
40 0 -200 1 1
]
[fern
{10 70 70 850}
{ { 0.00 0.00 0.00 0.16 0.00 0.00}
{ 0.20 -0.26 0.23 0.22 0.00 1.60}
{-0.15 0.28 0.26 0.24 0.00 0.44}
{ 0.85 0.04 -0.04 0.85 0.00 1.60}
}
50 0 -250 1 1
]
[tree
{400 100 1000 1000}
{ {0 0 0 0.5 0 0}
{0.1 0 0 0.1 0 0.2}
{0.42 -0.42 0.42 0.42 0 0.2}
{0.42 0.42 -0.42 0.42 0 0.2}
}
800
0
-300
1
1
]
[leaf
{150 150 150 500}
{ {0.40 -0.1 0.1 0.40 0.45 0.075}
{0.35 -0.5 0.5 0.35 0 0.45}
{0.55 0.43 -0.43 0.55 0 0.44}
{0.75 0.05 -0.05 0.75 0 1.6}
}
50
0
-200
1
1
]
[hexagon
{200 100 100 200 1000}
{ {0.333333 0 0 0.333333 -0.333333 0}
{0.166667 -0.288675 0.288675 0.166667 -0.0833333 0.144337}
{0.166666 0.288675 -0.288675 0.166666 0.0833333 0.144337}
{0.333333 0 0 0.333333 0.333333 0}
{0.506667 -0.859357 0.859357 0.506667 0.25 -0.433012}
}
300
-150
0
1
1
]
[koch3
{15 25 25 15 20}
{ {.307692 -.000000 .000000 .294118 4.119164 1.604278 .151515}
{.192308 -.205882 .653846 .088235 -0.688840 5.978916 .253788}
{.192308 .205882 -.653846 .088235 0.668580 5.962514 .253788}
{.307692 -.000000 .000000 .294118 -4.136530 1.604278 .151515}
{.384615 -.000000 .000000 -.294118 -0.007718 2.941176 .189394}
}
50 0 0 1 1
]
[fractint ; by Pieter Branderhorst
{ 0.06 0.03 0.02 0.06 0.02 0.02 0.02 0.04
0.07 0.07 0.02 0.06 0.03 0.03 0.03 0.06
0.03 0.06 0.07 0.06 0.06 0.08
}
{ { 0.00 -0.11 0.22 0.00 -6.25 4.84 0.06}
{ 0.11 0.02 0.00 0.11 -6.30 5.99 0.03}
{ 0.06 0.02 0.00 0.10 -6.25 4.51 0.02}
{ 0.00 -0.11 0.22 0.00 -4.34 4.84 0.06}
{ 0.08 0.00 0.00 0.11 -4.50 5.99 0.02}
{ 0.00 0.11 -0.08 0.00 -4.30 6.15 0.02}
{-0.09 0.00 -0.01 -0.13 -4.15 5.94 0.02}
{ 0.06 0.11 -0.13 0.00 -4.69 4.15 0.04}
{ 0.03 -0.11 0.23 0.11 -2.26 4.43 0.07}
{ 0.03 0.11 -0.25 0.00 -2.57 4.99 0.07}
{ 0.06 0.00 0.00 0.11 -2.40 4.46 0.02}
{ 0.00 0.11 -0.19 0.00 -1.62 4.99 0.06}
{ 0.09 -0.01 0.00 0.10 -0.58 2.96 0.03}
{-0.09 0.00 0.00 -0.11 -0.65 7.10 0.03}
{ 0.12 0.00 -0.00 0.11 1.24 6.00 0.03}
{ 0.00 0.11 -0.22 0.00 0.68 4.80 0.06}
{-0.12 0.00 0.00 -0.13 6.17 7.18 0.03}
{ 0.00 -0.11 0.22 0.00 6.78 4.84 0.06}
{ 0.00 0.08 -0.25 0.02 2.21 4.95 0.07}
{ 0.00 -0.11 0.22 0.00 4.10 4.84 0.06}
{ 0.00 -0.11 0.22 0.00 5.25 5.23 0.06}
{ 0.08 0.11 -0.25 0.00 3.57 4.99 0.08}
}
50
0
-300
1
1
]
]
; initaUCBLogo
initAlphabet "aUCBLogo
initAlphabet "Andreas
Micheler
initAlphabet 1234
initAlphabet 567890
initTree2
foreach (files "*.ifs)
[ IFSLoad ?
dat=(list [][][][][][][][])
dat.1=?
dat.2=p
dat.3=d
dat.4=sk
dat.5=x0
dat.6=y0
dat.7=1
dat.8=1
queue "data dat
]
ifsframe=(Frame [][IFSframe]
wxdefault_frame_style+wxstay_on_top+wxframe_tool_window
[0 520][100 500])
ifslistbox=(ListBox ifsframe [IFS Demos][]
[ odemoNr=demoNr
demoNr=(first ListBoxSelections)+1
throw "nextDemo
])
btrafomode=(Button ifsframe [&Trafomode][trafomode=not trafomode])
bquit=(Button ifsframe [&Quit][throw "stopping])
bs=BoxSizer wxvertical
BoxSizerAdd bs ifslistbox 2000 wxexpand 0
BoxSizerAdd bs btrafomode 100 wxexpand 0
BoxSizerAdd bs bquit 100 wxexpand 0
FrameSetSizer ifsframe bs
FrameSetClientSize ifsframe 100 450
foreach data
[ ListBoxAppend ifslistbox (word (?).1)
]
ConsoleSetFocus
initGraph
demoNr=1
odemoNr=1
running=true
catch "stopping
[ while [running]
[ catch "nextDemo
[ Ntrafo=Int count data.demoNr.2
dat=deepCopy data.odemoNr
Ntrafo=Int lcm Ntrafo count dat.2
dat.7=Ntrafo/count dat.2
dat.8=240/count dat.2
dat.2=enlarge dat.2 Ntrafo
dat.3=enlarge dat.3 Ntrafo
p=dat.2
d=dat.3
sk=dat.4
x0=dat.5
y0=dat.6
cf=dat.7
cf2=dat.8
initProbabilities
x=rSeqFA 0 0 maxii
y=rSeqFA 0 0 maxii
IFSiterate
on=n
od1=d1
od2=d2
od3=d3
od4=d4
od5=d5
od6=d6
opa=pa
osk=sk
ox0=x0
oy0=y0
skw=sk
x0w=x0
y0w=y0
ocf=cf
ocf2=cf2
dat=deepCopy data.demoNr
dat.7=Ntrafo/count dat.2
dat.8=240/count dat.2
dat.2=enlarge dat.2 Ntrafo
dat.3=enlarge dat.3 Ntrafo
p=dat.2
d=dat.3
sk=dat.4
x0=dat.5
y0=dat.6
cf=dat.7
cf2=dat.8
initProbabilities
pai=Int (ln n)/ln 2
; pai=maxi2
if demoNr != odemoNr
[ IFSMorphLoop
]
pai=Int (ln n)/ln 2
maxii=Int 2^pai
x=rSeqFA 0 0 maxii
y=rSeqFA 0 0 maxii
IFSLoop
]
]
]
FrameDestroy ifsframe
notFullScreen
splitScreen
end
to combineLetters a [l]
if empty? l [output a]
if (count l)==1 [output Array (map "combine a first l)]
output (combineLetters Array (map "combine a first l) first bf l)
end
be initAlphabet mytext
a=
{ {1 90 6 .0 -0.55 1 }
{1 -30 5 .15 -0.1 1 }
{1 30 5 .15 -1 1 }
{1 30 5 .45 -0.1 1 }
{1 -30 5 .45 -1 1 }
{1 -90 10 .6 -0.6 1 }
}
c=
{ {1 90 6 .0 -0.55 1 }
{1 -30 5 .15 -0.1 1 }
{1 30 5 .15 -1 1 }
{1 30 5 .45 -0.1 1 }
{1 -30 5 .45 -1 1 }
}
d=
{ {1 90 6 .0 -0.55 1 }
{1 -30 5 .15 -0.1 1 }
{1 30 5 .15 -1 1 }
{1 30 5 .45 -0.1 1 }
{1 -30 5 .45 -1 1 }
{1 -90 25 .6 0 .3}
}
e=
{ {1 90 6 .0 -0.55 1 }
{1 -30 5 .15 -0.1 1 }
{1 30 5 .15 -1 1 }
{1 30 5 .45 -0.1 1 }
{1 -30 5 .45 -1 1 }
{1 0 8 .25 -0.55 1 }
{1 -90 4 .6 -0.4 1 }
}
g=
{ {1 90 6 .0 -0.55 1 }
{1 -30 5 .15 -0.1 1 }
{1 30 5 .15 -1 1 }
{1 30 5 .45 -0.1 1 }
{1 -30 5 .45 -1 1 }
{1 -90 18 .6 -1 1 }
{1 -30 5 .45 -2 1 }
{1 30 5 .15 -2 1 }
}
h=
{ {1 -90 25 .0 0 .3}
{1 -30 5 .15 -0.1 1 }
{1 30 5 .45 -0.1 1 }
{1 90 10 .6 -0.6 .6}
}
i=
{ {1 -90 10 .3 -0.5 1 }
{1 0 5 .3 -1 1 }
{1 0 2 .3 0.5 1 }
{1 -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{1 90 8 .7 0.5 1 }
{1 0 6 .3 0 2 }
}
trafos={}
indexlist=[]
newlines=[]
foreach mytext
[ ifelse ?=="
[ newlines=lput (last indexlist) newlines
][ ifelse number? ?
[ trafos=combine trafos thing word "_ ?
][ trafos=combine trafos thing ?
]
]
indexlist=lput count trafos indexlist
]
newlines=lput count trafos newlines
len=count trafos
da=Array len
pa=Array len
xar=Array len
yar=Array len
xindex=0
yindex=first newlines
x0=0
y0=0
for [it 1 len]
[ da.it=FloatArray 6
if it > xindex
[ x0=x0+1
xindex=first indexlist
indexlist=butFirst indexlist
]
if it > yindex
[ y0=y0-2
x0=1
newlines=butFirst newlines
yindex=first newlines
xindex=first indexlist
indexlist=butFirst indexlist
]
xar.it=x0
yar.it=y0
]
xmax=(max xar+1)
xar2=(xar-xmax/2)
yar2=(yar-(min yar)/2)
xf=8/xmax
for [it 1 len]
[ ti=Array trafos.it
di=da.it
ti.3= ti.3/100
di.1= xf *ti.3* cos ti.2
di.2= ti.6*ti.3* sin ti.2
di.3= xf *ti.3*(sin ti.2)*(-1)
di.4= ti.6*ti.3* cos ti.2
di.5= ti.4*0.8+xar2.it
di.6= ti.5*0.8+yar2.it
da.it=di
pa.it=trafos.it.1
]
dat=(list [][][][][][][][])
dat.1=(list mytext)
dat.2=pa
dat.3=da
dat.4=100 ;sk
dat.5=0 ;x0
dat.6=0 ;y0
dat.7=1 ;cf
dat.8=1 ;cf2
push "data dat
end
to initTree2
r={0.0500 0.0500 0.6000 0.5000 0.5000 0.5500}
s={0.6000 -0.5000 0.5000 0.4500 0.5500 0.4000}
theta={0.0000 0.0000 0.6980 0.3490 -0.5240 -0.6980}
phi={0.0000 0.0000 0.6980 0.3492 -0.5240 -0.6980}
e_={0.0000 0.0000 0.0000 0.0000 0.0000 0.0000}
f={0.0000 1.0000 0.6000 1.1000 1.0000 0.7000}
d=Array 6
d.1= r*radCos theta
d.2=(s*radSin phi)*(-1)
d.3= r*radSin theta
d.4= s*radCos phi
d.5= e_
d.6= f
d=transposeArray d
dat=(list [][][][][][][][])
dat.1="Tree2
dat.2={1 1 1 1 1 1}
dat.3=d
dat.4=250 ;sk
dat.5=0 ;x0
dat.6= -280 ;y0
dat.7=1 ;cf
dat.8=1 ;cf2
queue "data dat
end
to transposeArray a
local [l l2 b]
l=count a
l2=count a.1
b=Array l2
for [i 1 l2]
[ tmp=FloatArray l
for [j 1 l]
[ tmp.j=a.j.i
]
b.i=tmp
]
output b
end
to enlarge p N
local [pn p2 f]
pn=count p
p2=Array N
f=pn/N
for [i 1 N]
[ p2.i=p.(1+Int (i-1)*f)
]
output p2
end
to readNumber
local [w]
w=bl readWord
if (first w)=="
[ w=bf w
]
;(type "A w "X)
output w
end
to IFSLoad filename
local [n di]
openRead filename
setReader filename
n=readNumber+1
p=array n
d=array n
;print typeof n
for [i 1 n]
[
di=array 6
for [j 1 6]
[ di.j=readNumber
]
d.i=di
p.i=readNumber
]
sk=readNumber
x0=readNumber-400
y0=300-readNumber
setReader []
close filename
p=p/(max p)
; (pr "p= p)
; (pr "d= d)
; (pr "sk= sk)
; (pr "x0= x0)
; (pr "y0= y0)
end
to IFSLoad2 filename
openRead filename
setReader filename
repeat 3 [ignore readWord]
x=readList
y=readList
sk=600*(x.2-x.1)
x0=x.1+x.2
y0=y.1+y.2
ignore readWord
n=readNumber
repeat 2 [ignore readWord]
d=array n
for [i 1 n]
[ l=readList
d.i=listToArray (list l.1 l.4 l.3 l.2 l.5 l.6)
]
repeat 2 [ignore readWord]
p=listToArray readList
setReader []
close filename
init
(pr "p= p)
(pr "d= d)
(pr "sk= sk)
(pr "x0= x0)
(pr "y0= y0)
end
to initProbabilities
(reRandom 0)
n=count p
p0=0
for [i 1 n]
[ p.i=p0+p.i
p0=p.i
]
p=p/(max p)
pa=Array maxi2
pai=Int (ln n)/ln 2
for [l pai maxi2]
[ l2=2^l
pat=IntArray l2
k=1
for [i 1 n]
[ kmax=Int p.i*l2
if kmax >= k
[ setItems k pat IntArray rseq i i kmax-k+1
; for [j k kmax]
; [
;(show j i)
; pat.j=i
; ]
]
k=kmax+1
]
pa.l=pat
;show p
;show pa.l
pa.l=shuffle pa.l
;show pa
]
maxii=Int 2^pai
m=count d
d1=FloatArray m
d2=FloatArray m
d3=FloatArray m
d4=FloatArray m
d5=FloatArray m
d6=FloatArray m
for [i 1 m]
[ d1.i=(d.i).1
d2.i=(d.i).2
d3.i=(d.i).3
d4.i=(d.i).4
d5.i=(d.i).5
d6.i=(d.i).6
]
end
to shuffle_Logo a
local [n j k tmp]
n=count a
for [i 1 n]
[ j=1+random n
k=1+random n
tmp=a.j
a.j=a.k
a.k=tmp
]
end
to IFSLoop
local [running]
running=true
while [running]
[ IFSiterate
(GC true)
if Key?
[ ch=readChar
case ch
[ [[char 27] throw "stopping]
["\ trafomode=not trafomode]
["c clearScreen]
[else running=false]
]
]
]
end
to IFSMorphLoop
w=1
local [running]
running=true
while [running and2 w > 0]
[ IFSiterateMorph
(GC true)
if Key?
[ ch=readChar
case ch
[ [[char 27] throw "stopping]
["\ trafomode=not trafomode]
["c clearScreen]
[else running=false]
]
]
]
for [i 1 5]
[ IFSiterateMorph
]
end
to initGraph
; cs
ht
noRefresh
; singleBuffer
PenUp
setXY -400 -300
bm=BitCopy 800 600
bx=BitMaxX bm
by=BitMaxY bm
t=16
PenDown
end
to IFSiterate
local [p]
p=pa.pai
for [i 1 2]
[ xx= d1.p*x + d2.p*y + d5.p
yy= d3.p*x + d4.p*y + d6.p
xi= xx*sk+x0
yi= yy*sk+y0
ifelse trafomode
[ setPixelXY xi yi
; IntArray (mod (FloatArray (p-1))/cf 15)+1
pal.(IntArray
(FloatArray (IntArray (FloatArray p-1)/cf))
*cf2+15)
][
setPixelXY xi yi pal.Int t
]
ignore [
xb=xi-400
yb=yi-300
for [j 1 [count x]]
[ c=addColorsMod (BitPixel bm xb.j yb.j) pal.Int t
BitSetPixel bm xb.j yb.j c
setPixelXY xi.j yi.j c
]
]
ox=x
oy=y
x=xx
y=yy
p=rotate p random maxii
t=(mod t palsize)+1
]
pa.pai=p
ifelse pai < maxi2
[ pai=pai+1
maxii=maxii*2
x=combine x ox
y=combine y oy
][
updateGraph
dispatchMessages
]
end
to IFSiterateMorph
w1=1-w
d1w=od1*w+d1*w1
d2w=od2*w+d2*w1
d3w=od3*w+d3*w1
d4w=od4*w+d4*w1
d5w=od5*w+d5*w1
d6w=od6*w+d6*w1
skw=(skw*4+osk*w+sk*w1)/5
x0w=(x0w*4+ox0*w+x0*w1)/5
y0w=(y0w*4+oy0*w+y0*w1)/5
maxx=(max x)
minx=(min x)
maxy=(max y)
miny=(min y)
if maxy-miny != 0
[ skw=(skw*4
+(1-sin 180*w)*skw
+( sin 180*w)
*(600/(sqrt (sqr maxx-minx)+(sqr maxy-miny))))/5
]
x0w=(x0w*4
+ (1-sin 180*w)*x0w
- ( sin 180*w)*skw*(minx+maxx)/2)/5
y0w=(y0w*4
+ (1-sin 180*w)*y0w
- ( sin 180*w)*skw*(miny+maxy)/2)/5
cfw=ocf*w+cf*w1
cf2w=ocf2*w+cf2*w1
maxii=Int 2^pai
x=rSeqFA 0 0 maxii
y=rSeqFA 0 0 maxii
for [k pai maxi2Move]
[
if k <= maxi2Move
[ p=pa.k
op_=opa.k
pw=(IntArray (FloatArray op_-1)*w+(FloatArray p-1)*w1)+1
]
for [i 1 2]
[ xx= d1w.pw*x + d2w.pw*y + d5w.pw
yy= d3w.pw*x + d4w.pw*y + d6w.pw
xi= xx*skw+x0w
yi= yy*skw+y0w
ifelse trafomode
[ setPixelXY xi yi
pal.(IntArray
(FloatArray (IntArray (FloatArray pw-1)/cfw))
*cf2w+15)
][
setPixelXY xi yi pal.Int t
]
x=xx
y=yy
ox=x
oy=y
pw=rotate pw random maxii
t=(mod t palsize)+1
]
ifelse k < maxi2Move
[ x=combine x ox
y=combine y oy
pa.k=rotate p random maxii
opa.k=rotate op_ random maxii
maxii=Int 2^k
][
if Key? [break]
]
]
updateGraph
dispatchMessages
clearScreen
if w > 0
[ w=w-0.01
if w <=0
[ w=0
]
]
end