home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / f / fractal112 / !Fractal / Help / L-Systems < prev    next >
Text File  |  1995-09-05  |  14KB  |  314 lines

  1.   ________________________________________________________________________
  2.  /                                                                        \
  3. |                   !Fractal : Help On L-Systems                           |
  4. |                                                                          |
  5. |                          September 1995                                  |
  6.  \________________________________________________________________________/ 
  7.  
  8. L-System : Turtle graphics as used for drawing plants etc.
  9. --------
  10. The L-system uses a LOGO like turtle language to describe shapes as a series
  11. of movements, and was introduced by A. Lindenmayer to help describe plants.
  12. Refer to the book The Algorithmic Beauty of Plants for full details of the
  13. work by Prusinkiewicz and Lindenmayer. Up to 80 definitions are stored
  14. internally, and can be saved as a text file, or a new file may be loaded.
  15.  
  16. Each shape definition is made up of the following components:
  17.  
  18. Name: 1-19 character name for identification.
  19.  
  20. Iterations: the number of times the algorithm is recursively expanded.
  21.  
  22. Angles: Rather than describing the amount of each turn as so many degrees,
  23. each turn is expressed as a fraction of a circle. Thus 6=60° (360°/6). The
  24. number should be even if you plan to use the '|' command to allow turns of
  25. 180°.
  26.  
  27. Axiom: a string of 1-255 characters incorporating turtle commands and rules.
  28.  
  29. Rules: a single letter identifier and 0-255 characters consisting of further
  30. rules or turtle commands. Note that the case of letters is significant.
  31.  
  32. The routine starts by taking the axiom string and then replaces each rule
  33. character in it by the equivalent rule string. This process is repeated
  34. for the number of iterations specified.
  35.  
  36. Thus if the axiom is F-F and the rule F=F+F, after the first expansion we
  37. get :  F+F-F+F, then F+F+F+F-F+F+F+F, and so on.
  38. After expansion the string is interpreted as a series of turtle commands,
  39. any rule characters being ignored. 
  40.  
  41. The key to the routine is this recursive expansion, and often the use of
  42. F as a rule and turtle command (which is somewhat confusing I admit, but
  43. very important).
  44.  
  45. Drawing
  46. -------
  47. Because the size of the image is unknown at the outset, the plot has to be
  48. repeated, with the image being correctly scaled to fit on the screen on the
  49. second pass. However you can use zooming or turn off Auto Scaling (see
  50. later), in which case only a single plot is performed.
  51.  
  52. Use Adjust to stop a plot. Note that currently it is not possible to restart
  53. a plot after Adjust is pressed. You are advised to start at low iterations
  54. and work up.
  55.  
  56. Basic Turtle Commands
  57. ---------------------
  58. The characters used are those in standard use. Note that 'F' is different
  59. from 'f'. (Fractint uses 'G' for 'f' since it is case insensitive).
  60. Initially the unit line length is 1 and the direction is along the x-axis.
  61.  
  62. F : draw a line forwards in the current direction and length.
  63. D : same as F, ie. draw a line forwards.
  64. f : move forwards without drawing a line.
  65. - : turn anti-clockwise 1 angle (see definition of angle above).
  66. + : turn clockwise 1 angle.
  67. | : turn 180°. Note - angle must be even for this to work correctly.
  68.  
  69. Advanced Turtle Commands
  70. ------------------------
  71. To get more complex displays requires the use of one or more these commands.
  72.  
  73. [  : stack the current position, angle, line length, width and colour.
  74. ]  : unstack the turtle details.
  75. !  : reverse meaning of '+' and '-'.
  76. cn : Set colour to n where n=0-255. See below for colour numbering.
  77. >n : increment colour by n where n is one or more digits.
  78. <n : decrement colour by n.
  79. @n : multiply the line length by n. The initial length is 1. 'n' is 1 or
  80.      more decimal digits and may contain a decimal place.
  81.      To divide precede the number by I (for inverse). eg. @I3 divides by 3,
  82.      or use @0.333. 
  83.      Precede the number by 'Q' for the square root, eg. @Q2 = length * 1.414
  84. #n : Multiply the line width by n - the initial width is a single pixel.
  85.      Numbers may be specified as for line length.
  86. {sprite} : Plots a sprite of this name at the current position and rotation.
  87.            The sprite is plotted the same size as the current line size.
  88.            See below for full details.
  89. {sprite,n} : As above but plots at the scale specified as 'n'.
  90.  
  91. Colour
  92. ------
  93. The initial colour is 255 (white in the default palette). To get a sensible
  94. progression of colours use the RGB palette.
  95.  
  96. If the colour exceeds 255 it wraps around. If a colour falls between 0-7
  97. when using < or >, then it is incremented/decrmented by 8, since colours 0-7
  98. are assumed to be too dark to be seen.
  99.  
  100. Menu Options
  101. ============
  102. The menu options are described next.
  103.  
  104. Data Entry Panel
  105. ----------------
  106. Use this panel to update the L-system data, or select a new L-system. To
  107. move the caret around the icons use !Fractal's standard editing keys. The
  108. various icons are:
  109.  
  110. Input: You must click on this for your changes to take effect.
  111.  
  112. Re-draw: This is the same as Input followed by a re-draw request.
  113.  
  114. Store: This takes the data and stores it in the internal file. If you move
  115. to another L-system without using this option your updates will be lost!
  116.  
  117. Restore: Refreshes the data on display from the copy in the internal file.
  118. This lets you back out changes without having to re-load the file.
  119.  
  120. Copy: Takes a copy of the current L-system so that you can edit it without
  121. modifying the original. You should give the copy a new name to avoid
  122. confusion.
  123.  
  124. Delete: Deletes the current L-system from the internal file.
  125.  
  126. Name: the 1-19 character identifier for this L-system.
  127.  
  128. Item: click on the left or right arrows to move to a different L-system.
  129. Remember to use Store if you want to keep any changes to the current
  130. L-system.
  131.  
  132. Iterations: Use the arrows to change or click on the number to key in a new
  133. value. Higher iterations give more complex patterns but will take much
  134. longer to draw.
  135.  
  136. Angle: determines the amount of turn for '+' and '-'.
  137.  
  138. Axiom: the 1-31 character string that is the initial rule.
  139.  
  140. Rules: Each rule must have a unique character for identification. Up to 9
  141. rules may be use, each of 0-79 characters. A null rule can be used to strip
  142. out turtle commands during expansion (see Cesaro for example). Remember to
  143. click Input or Redraw to enter your values.
  144.  
  145. L-System List Panel
  146. -------------------
  147. This panel lists all the L-systems that are held internally, showing the
  148. first 11 characters of their name with the current name being highlighted.
  149. Click on a name to select one. The predefined shapes all assume that the
  150. Default palette is in use - this is mainly of importance when plotting the
  151. plant shaped images.
  152.  
  153. Save
  154. ----
  155. The internal file of L-system definitions can be saved as a text file by
  156. dragging the text icon to a filer window. The associated sprites will be
  157. saved in the same directory if not already present. Saved definitions can be
  158. reloaded at any time - !Fractal will automatically select L-system if it is
  159. not the current fractal. Three files of definitions are supplied - click on
  160. Misc->Resouces to open a Filer window showing the files available.
  161.  
  162. You can edit the text file, but be careful to keep to the format which is:
  163.       L-System
  164.       sprite filename
  165.       Name=l-system name            } for each
  166.       Iter=iterations               } L-System
  167.       Angles=no. angles             }
  168.       Axiom=axiom string            }
  169.       ruleid=rule text              } 1 for each rule
  170.  
  171. The supplied definitions come from the Science of Fractals, Algorithmic
  172. Beauty of Plants, Fractint, and John Greening. Please send in more functions
  173. to AFG so we can all see them. I have added colour and sprites to some of
  174. the shapes.
  175.  
  176. Auto Scaling
  177. ------------
  178. When on this ensures that the image is automatically scaled to the maximum
  179. displayable size. Turn it off if you want to manually position the image -
  180. this is useful if you want to plot multiple shapes and place each at a
  181. certain position. To do this turn Image->Redraw->Clear off and manually set
  182. the x0/y0 (bottom left coords) and width/height values in the Image->Data
  183. panel. Remember that a unit length is 1 and plotting begins at 0,0. The best
  184. way to determine the values required for a shape is to draw the shape with
  185. auto sc