[REBOL] Re: (for Carl :-) Re: Re: SHEEP vs Rebol
From: greggirwin:mindspring at: 14-Oct-2001 10:28
Hi Carl,
<< So, do we get to see the script? (: >>
I wasn't sure if people would be interested. Here it is.
-- Tree of Pythagoras
-- based on an old E example by Raymond Hoving
REBOL [
Comment: {
Converted to REBOL by Gregg Irwin for testing purposes.
}
]
pyth-tree: func [
a[pair!] b[pair!]
depth[integer!] face
/local c d e color
][
c: d: e: 0x0
color: 0.255.0 - (depth * 10)
c/x: (a/x - a/y + b/y)
c/y: (a/x + a/y - b/x)
d/x: (b/x + b/y - a/y)
d/y: (a/x - b/x + b/y)
e/x: (0.5 * (c/x - c/y + d/x + d/y))
e/y: (0.5 * (c/x + c/y - d/x + d/y))
append draw-cmds compose [pen (color) line]
append draw-cmds reduce [c a b d c e d]
;print [c a b d c e d]
;show face
if depth < 12 [
pyth-tree c e (depth + 1) face
pyth-tree e d (depth + 1) face
]
;wait .05
]
world-size: 640x520
start-pt-1: 266x450
start-pt-2: 374x450
lay: layout [
size world-size
backdrop black
origin 0x0
canvas: image 640x480 effect [draw []]
across
button "go" [
clear draw-cmds
show canvas
print now/precise
pyth-tree start-pt-1 start-pt-2 0 canvas
print now/precise
show canvas
]
button "quit" [quit]
]
draw-cmds: second canvas/effect
print ""
view lay
--Gregg