home *** CD-ROM | disk | FTP | other *** search
/ Photo CD Demo 1 / Demo.bin / graphtal / examples / roseleaf.lsy < prev    next >
Text File  |  1992-10-30  |  886b  |  29 lines

  1. /*
  2.  * Example of a rose leaf.
  3.  *
  4.  * The Algorithmic Beauty of Plants, p. 126
  5.  */
  6.  
  7. lsystem roseleaf;
  8.  
  9. const LA = 5;    // initial length - main segment
  10.       RA = 1.15; // growth rate - main segment
  11.       LB = 1.3;  // initial length - lateral segment
  12.       RB = 1.25; // growth rate - lateral segment
  13.       LC = 3;    // inital length - marginal notch
  14.       RC = 1.19; // growth rate - marginal notch
  15.  
  16. table roseleaf {
  17.      A(t,d) :d == 0 -> sv G (LA, RA) sv [ tu(60)  B(t) G(LC, RC, t) sv }]
  18.                      [tu(60) B(t) { sv ] A(t+1, d);
  19.      A(t,d) :d == 1 -> sv G (LA, RA) sv [ tu(-60) B(t) G(LC, RC, t) sv }]
  20.                       [tu(-60) B(t) { sv ] A(t+1, d);    
  21.      B(t)   :t>0    -> G(LB, RB) B(t-1);
  22.      G(s,r)           -> G(s*r, r);
  23.      G(s,r,t):t>1     -> G(s*r,r, t-1);
  24. };
  25.  
  26. attributes {
  27.  axiom  co("Green") [ {A(0,0) sv} ] [ {A(0,1) sv} ];
  28.  derivation roseleaf(25);
  29. };