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

  1. /*
  2.  * Example a sunflower head.
  3.  *
  4.  * The Algorithmic Beauty of Plants, p. 103
  5.  *
  6.  * Instead of a real seed shape, we simply use spheres
  7.  * and the petal shapes are triangles.
  8.  */
  9.  
  10. lsystem sunflower;
  11.  
  12. table sunflowerHead {
  13.   A(n) -> tu(137.5) [ G(n^0.5) C(n) ] A(n+1);
  14.   C(n) :n <= 440 -> co("brown") s(1.1);
  15.   C(n) : 440 < n && n <= 565 -> co("SaddleBrown") s(1.2); 
  16.   C(n) : 565 < n && n <= 580 -> { 
  17.                                   sv tu(45) G sv tu(-45) G sv co("yellow")
  18.                             };
  19.   C(n) : 580 < n && n <= 595 -> {
  20.                                   sv tu(45) G sv tu(-45) G sv co("LightYellow") 
  21.                             };
  22.   C(n) : 595 < n && n <= 610 -> {
  23.                               sv tu(45) G sv tu(-45) G sv co("LightGoldenrodYellow") 
  24.                             }; 
  25.   C(n) : 610 < n             -> { 
  26.                               sv tu(45) G sv tu(-45) G sv co("gold") 
  27.                             }; 
  28. };
  29.  
  30. attributes {
  31.    axiom  A(0);
  32.    derivation sunflowerHead(630);
  33. };
  34.