Here the source:
REBOL [
title: "Barnsley formula"
author: [cyphre@rebol.com "Massimiliano Vessi"]
type: 'graphic
Purpose: {
Michael Barnsley generated the fractal pattern that's now known
as Barnsley's Fern. It's supposed to resemble the Black Spleenwort,
Asplenium adiantum-nigrum. }
]
time: func [b /local start] [
start: now/precise
do b
print ["Time:" difference now/precise start]
]
img-size: 512x384
oftx: 200
isx: img-size/x
img: make image! img-size
img/rgb: 72.96.120
view/new layout [
across
ii: image img
return
aa: text "xxxxxxx"
text " / 10000"
]
random/seed now
barnsley: func [/local x y nb t px py ry pxi pyi idx1 idx2 ][
x: 64.0
y: 0.0
px: 0.0
py: 0.0
ry: 0.0
nb: 10000
repeat k nb [
aa/text: to-string k
show [ii aa]
t: ( (random 100 ) - 1 ) / 100
either (t >= 0.3 ) [
px: (x * 0.781) + (y * 0.034) + 13.76
py: (x * -0.032) + ( y * 0.739) + 70.2
;draw
x: px
y: py
pxi: to-integer x
pyi: to-integer y
idx1: ((320 - pyi) * isx) + pxi + oftx
idx2: ((320 - pyi + 4 ) * isx ) + 4 + pxi + oftx
poke img idx1 white
poke img idx2 gray
;end draw
] [
either (t >= 0.17) [
px: (x * 0.17) - (y * 0.215) + 52.224
py: (x * 0.222) + (y * 0.176) + 23.218
;draw
x: px
y: py
pxi: to-integer x
pyi: to-integer y
idx1: ((320 - pyi) * isx) + pxi + oftx
idx2: ((320 - pyi + 4) * isx) + 4 + pxi + oftx
poke img idx1 white
poke img idx2 gray
;end draw
] [
either (t >= 0.02 ) [
px: (x * -0.139) + (y * 0.263) + 72.96
py: (x * 0.246) + ( y * 0.224) - 9.36
;draw
x: px
y: py
pxi: to-integer x
pyi: to-integer y
idx1: ((320 - pyi) * isx) + pxi + oftx
idx2: ((320 - pyi + 4) * isx ) + 4 + pxi + oftx
poke img idx1 white
poke img idx2 gray
;end draw
] [
px: 64.0
py: 0.27 * y
]
]
]
;draw
x: px
y: py
pxi: to-integer x
pyi: to-integer y
idx1: ((320 - pyi ) * isx ) + pxi + oftx
idx2: ((320 - pyi + 4 ) * isx) + 4 + pxi + oftx
poke img idx1 white
poke img idx2 gray
;end draw
]
]
time [barnsley]
show ii
wait 10