blob: ef8f69f587c29bb6758be94a8cb51885c0ce40f2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
#N canvas 3 2 602 516 10;
#X obj 14 66 gemwin;
#X obj 14 9 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 1
;
#X msg 48 10 create;
#X msg 55 33 destroy;
#X obj 14 93 gemhead;
#X text 170 17 A tutorial on recursion in Gem;
#X text 170 37 (GPL) 2007 Claude Heiland-Allen <claude@mathr.co.uk>
;
#X obj 24 163 r \$0-recurse;
#X obj 68 133 v \$0-depth;
#X obj 14 113 t a b;
#X floatatom 91 96 5 0 0 2 max-depth - -;
#X obj 14 253 t a a;
#X obj 59 253 circle;
#X obj 14 223 separator;
#X obj 36 473 s \$0-recurse;
#X obj 14 353 t b a b;
#X obj 99 383 v \$0-depth;
#X obj 99 403 - 1;
#X obj 99 423 max 0;
#X obj 99 443 v \$0-depth;
#X obj 36 453 spigot;
#X obj 14 383 v \$0-depth;
#X obj 14 423 v \$0-depth;
#X obj 14 403 + 1;
#X obj 184 253 t a a;
#X obj 229 253 circle;
#X obj 206 473 s \$0-recurse;
#X obj 184 353 t b a b;
#X obj 269 383 v \$0-depth;
#X obj 269 403 - 1;
#X obj 269 423 max 0;
#X obj 269 443 v \$0-depth;
#X obj 206 453 spigot;
#X obj 184 383 v \$0-depth;
#X obj 184 423 v \$0-depth;
#X obj 184 403 + 1;
#X obj 184 223 separator;
#X obj 14 183 t a a;
#X obj 184 303 translate 1.5 0 1 0;
#X obj 184 323 scale 0.5;
#X obj 14 323 scale 0.5;
#X obj 14 303 translate 1.5 0 1 0;
#X obj 14 283 rotate -30 0 0 1;
#X obj 184 283 rotate 30 0 0 1;
#X obj 68 113 f 4;
#X text 170 77 The simplest recursive branching structure is one that
splits into two at each branch. Essentially what we are creating is
a circle \, plus two transformed copies of the whole structure \, limited
to a maximums depth of recursion.;
#X text 170 137 Be careful not to increase the max-depth too much:
the splitting at each recursion leads to an exponential increase in
the number of circles to be drawn.;
#X connect 1 0 0 0;
#X connect 2 0 0 0;
#X connect 3 0 0 0;
#X connect 4 0 9 0;
#X connect 7 0 37 0;
#X connect 9 0 37 0;
#X connect 9 1 44 0;
#X connect 10 0 44 1;
#X connect 11 0 42 0;
#X connect 11 1 12 0;
#X connect 13 0 11 0;
#X connect 15 0 21 0;
#X connect 15 1 20 0;
#X connect 15 2 16 0;
#X connect 16 0 17 0;
#X connect 17 0 18 0;
#X connect 18 0 19 0;
#X connect 18 0 20 1;
#X connect 20 0 14 0;
#X connect 21 0 23 0;
#X connect 23 0 22 0;
#X connect 24 0 43 0;
#X connect 24 1 25 0;
#X connect 27 0 33 0;
#X connect 27 1 32 0;
#X connect 27 2 28 0;
#X connect 28 0 29 0;
#X connect 29 0 30 0;
#X connect 30 0 31 0;
#X connect 30 0 32 1;
#X connect 32 0 26 0;
#X connect 33 0 35 0;
#X connect 35 0 34 0;
#X connect 36 0 24 0;
#X connect 37 0 13 0;
#X connect 37 1 36 0;
#X connect 38 0 39 0;
#X connect 39 0 27 0;
#X connect 40 0 15 0;
#X connect 41 0 40 0;
#X connect 42 0 41 0;
#X connect 43 0 38 0;
#X connect 44 0 8 0;
|