#N canvas 6 61 602 553 10;
#X declare -lib Gem;
#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 233 r \$0-recurse;
#X obj 88 213 v \$0-depth;
#X obj 14 193 t a b;
#X floatatom 111 176 5 0 17 2 max-depth - -;
#X obj 14 293 t a a;
#X obj 14 273 separator;
#X obj 36 533 s \$0-recurse;
#X obj 14 413 t b a b;
#X obj 99 443 v \$0-depth;
#X obj 99 463 - 1;
#X obj 99 483 max 0;
#X obj 116 533 v \$0-depth;
#X obj 36 513 spigot;
#X obj 14 443 v \$0-depth;
#X obj 14 483 v \$0-depth;
#X obj 14 463 + 1;
#X obj 184 293 t a a;
#X obj 206 533 s \$0-recurse;
#X obj 184 413 t b a b;
#X obj 269 443 v \$0-depth;
#X obj 269 463 - 1;
#X obj 269 483 max 0;
#X obj 286 533 v \$0-depth;
#X obj 206 513 spigot;
#X obj 184 443 v \$0-depth;
#X obj 184 483 v \$0-depth;
#X obj 184 463 + 1;
#X obj 184 273 separator;
#X obj 14 253 t a a;
#X obj 184 363 translate 1.5 0 1 0;
#X obj 14 363 translate 1.5 0 1 0;
#X obj 14 343 rotate -30 0 0 1;
#X obj 184 343 rotate 30 0 0 1;
#X obj 88 193 f 4;
#X text 211 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 211 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 obj 497 15 declare -lib Gem;
#X obj 259 506 t a a;
#X obj 89 506 t a a;
#X obj 14 135 scale 0.4 0.4 1;
#X obj 14 383 scale 0.95 0.95 1;
#X obj 184 383 scale 0.95 0.95 1;
#X obj 259 316 circle;
#X obj 59 316 circle;
#X obj 59 293 color 1 0 0;
#X obj 259 293 color 0 0 1;
#X obj 14 114 translateXYZ 2 -1 0;
#X connect 1 0 0 0;
#X connect 2 0 0 0;
#X connect 3 0 0 0;
#X connect 4 0 53 0;
#X connect 7 0 35 0;
#X connect 9 0 35 0;
#X connect 9 1 40 0;
#X connect 10 0 40 1;
#X connect 11 0 38 0;
#X connect 11 1 51 0;
#X connect 12 0 11 0;
#X connect 14 0 20 0;
#X connect 14 1 19 0;
#X connect 14 2 15 0;
#X connect 15 0 16 0;
#X connect 16 0 17 0;
#X connect 17 0 45 0;
#X connect 19 0 13 0;
#X connect 20 0 22 0;
#X connect 22 0 21 0;
#X connect 23 0 39 0;
#X connect 23 1 52 0;
#X connect 25 0 31 0;
#X connect 25 1 30 0;
#X connect 25 2 26 0;
#X connect 26 0 27 0;
#X connect 27 0 28 0;
#X connect 28 0 44 0;
#X connect 30 0 24 0;
#X connect 31 0 33 0;
#X connect 33 0 32 0;
#X connect 34 0 23 0;
#X connect 35 0 12 0;
#X connect 35 1 34 0;
#X connect 36 0 48 0;
#X connect 37 0 47 0;
#X connect 38 0 37 0;
#X connect 39 0 36 0;
#X connect 40 0 8 0;
#X connect 44 0 30 1;
#X connect 44 1 29 0;
#X connect 45 0 19 1;
#X connect 45 1 18 0;
#X connect 46 0 9 0;
#X connect 47 0 14 0;
#X connect 48 0 25 0;
#X connect 51 0 50 0;
#X connect 52 0 49 0;
#X connect 53 0 46 0;
