1#!/usr/bin/perl
2#
3# Example of using a lsys fractal,
4# which in turm used Turtle Graphics
5#
6use Cwd;
7use lib cwd;
8require "lsys.pl";
9
10%rule = (
11	  'A' => 'S[---LMA][++++B]',
12          'B' => 'S[++LBg][--Cg]',
13          'C' => 'S[-----LB]GS[+MC]',
14          'g' => '',
15          'L' => '[{S+S+S+S+S+S}]'
16        );
17
18%stemchanges = (
19  distance => 18.5,
20  dtheta => 0.1,
21  motionsub => sub{
22                    $im->Draw ( primitive=>'line', points=>join(' ',@_),
23                                stroke=>'dark green', strokewidth=>1 );
24                  }
25);
26
27%polychanges = (
28  distance => 3,
29  dtheta => 0.4,
30  motionsub => sub{ push( @poly, @_[0..1] ); }
31);
32
33$changes = \%stemchanges;
34lsys_init(400);
35lsys_execute('A', 10, "tree.gif", %rule);
36