home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / f / fractrace / !FracTrace / FTS-Def < prev    next >
Encoding:
Text File  |  1990-07-22  |  15.4 KB  |  334 lines

  1. FracTrace Script (FTS) command descriptions
  2. -------------------------------------------
  3.  
  4. An FTS file is a plain ASCII text file containing the commands and their
  5. right parameters to describe a fractal surface and its rendering in 
  6. FracTrace.
  7.  
  8. Lines may contain : - a single command
  9.                     - multiple commands, separated by a semi-colon ';'
  10.                     - comments, preceded by a back-slash '\'
  11.                     - the combination of both commands and comments
  12.  
  13. Some good examples of FTS files can be found in the 'FTS-Files' directory.
  14.  
  15. A description of each individual command follows underneath:
  16.  
  17.  
  18. Command              Description
  19. -----------------------------------------------------------------------------
  20. Title                Sets the title for the current surface(s). This title is
  21.                      used for all file-handling. A string of maximum eight
  22.                      characters is given as the sole parameter.
  23.                      Example: Title Snowy
  24.  
  25. Frames               Sets the maximum number of 'frames'. The parameter is an
  26.                      integer. 
  27.                      Example: Frames 24
  28.  
  29. Scope                Sets the range of frames to be rendered. If you have set
  30.                      the maximum number of frames to, say 24, it is possible
  31.                      to set the range of frames to be rendered to any
  32.                      interval within 1..24. The two parameters are the 
  33.                      minimum and maximum frame number.
  34.                      Example: Scope 3,18
  35.  
  36. Mandelbrot           Tells the program that the set to be used is the
  37.                      Mandelbrot Set. This command takes no parameters.
  38.  
  39. Julia                Tells the program that the set to be used is a Julia
  40.                      Set. This command takes no parameters.
  41.  
  42. Resolution           Sets the resolution of the surface to be calculated and/
  43.                      or rendered. The units for this resolution may be 
  44.                      regarded as pixels. The two parameters are the x and y 
  45.                      resolution of the surface.
  46.                      Example: Resolution 300,300
  47.  
  48. Range                Sets the range in the complex plane for the part of the
  49.                      set that is to be calculated and/or rendered. The four
  50.                      parameters are minimum x, maximum x (real axis), minimum
  51.                      y, maximum y (imaginary axis). These values can best be
  52.                      obtained from a normal Mandelbrot plotting program!
  53.                      Example: Range -1.5,1.5,-1.5,1.5
  54.  
  55. Cval                 Sets the real and imaginary part of the point to 
  56.                      calculate and/or render the Julia Set of. The two 
  57.                      parameters are the real and imaginary part of the point.
  58.                      Example: Cval 0.32,0.043
  59.  
  60. Smoothness           Sets the smoothness of the surface. The higher the
  61.                      smoothness-value, the smoother the surface, and the more
  62.                      calculations will be performed to obtain the potential 
  63.                      of a point on the surface! The sole parameter is an
  64.                      integer, which really should be at least about 100!
  65.                      Example: Smoothness 120
  66.  
  67. Depth                Sets the depth of the iterations in the calculation of 
  68.                      the potential of a point. The higher the value, the more
  69.                      precise the set will be calculated, and again, the 
  70.                      longer it takes to calculate a point-potential. The 
  71.                      parameter is an integer in the range 1..127!!!
  72.                      Example: Depth 100
  73.  
  74. Mountains            Tells the program to render the surface as a mountain.
  75.                      This command takes no parameters.
  76.  
  77. Valleys              Tells the program to render the surface as a valley.
  78.                      This command takes no parameters.
  79.  
  80. Light                Sets the direction of the light-vector. This vector
  81.                      need not be normalised. Note that this vector is the
  82.                      direction of the light-rays, ie. it points away from the
  83.                      light source! The three parameters are the x, y, and z
  84.                      components of the vector. (z always should be negative!)
  85.                      Example: Light 0.5,1,-2        
  86.  
  87. Brightness           Sets the brightness of the light-source. The higher the
  88.                      value, the brighter the light. The sole parameter is an
  89.                      integer.
  90.                      Example: Brightness 78
  91.  
  92. Steepness            Sets the steepness of the mountain/valley slopes. The
  93.                      higher the value, the steeper the slopes. Note that the
  94.                      magnitude of this value is disproportional with size of
  95.                      the region indicated with the range command. The sole
  96.                      parameter is an integer.
  97.                      Example: Steepness 240
  98.  
  99. Dithering            Sets the color-dithering factor. Because the program
  100.                      only uses 16 colors to render an image (due to the 4bit
  101.                      nature of mode 12), abrupt color changes on the surface
  102.                      may give a non-realistic feel to the image. Therefore,
  103.                      a simple technique, called random dithering, is used to
  104.                      produce intermediate 'pseudo-colors', which make the
  105.                      color changes seem quite continuous. A value of 1 means
  106.                      no color dithering. The sole parameter is an integer.
  107.                      Example: Dithering 16
  108.  
  109. Shadows              Tells the program wether to calculate shadows or not.
  110.                      The calculation of shadows slows down the rendering
  111.                      quite drastically. The parameter is a string of the form
  112.                      'On' or 'Off'.
  113.                      Example: Shadows On
  114.  
  115. Interpolation        Tells the program wether to interpolate values in the
  116.                      horizontal direction. Interpolating doubles the time 
  117.                      needed for rendering an image, but it produces more
  118.                      detail. An image created with interpolation off has
  119.                      'mode 9' resolution, whereas images created with
  120.                      interpolation on have a true 'mode 12' resolution.
  121.                      The parameter is a string of the form 'On' or 'Off'.
  122.                      Example: Interpolation Off
  123.  
  124. Offset               Sets the two 'screen offsets' for the image. A 
  125.                      horizontal offset of 0 would place the image to the left
  126.                      edge of the screen. A vertical offset of 0 would place
  127.                      the image half way below the bottom edge of the screen.
  128.                      Normally, the x (horizontal) offset should remain at 40,
  129.                      and the y (vertical) offset should vary between 240 and
  130.                      480, depending on the angle at which to view the 
  131.                      image. The two parameters are the x and y offsets.
  132.                      Example: Offset 40,380
  133.  
  134. Angle                Sets the viewing angles. The first value is the x angle,
  135.                      a value of 0 makes you look at the image 'head-on'.
  136.                      The second value is the y angle, which should be in the
  137.                      range 15..90 to get a meaningful view on the image, 30
  138.                      being a quite reasonable average. In the current 
  139.                      versions of FracTrace, the x angle is best kept at 0!
  140.                      The two parameters are the x and y viewing angles.
  141.                      Example: Angle 0,25
  142.  
  143. Increment            Sets the x and y 'OS-Unit' increment steps when 
  144.                      rendering the surface. These values are both best kept
  145.                      at 4!
  146.                      Example: Increment 4,4
  147.  
  148. Slope Front          Sets the front-slope range and steepness. For some 
  149.                      images it will be necessary to use this feature to avoid
  150.                      the artificial cut-off of the front-most edge of the
  151.                      surface. When you do have an image that seems to be
  152.                      'cut off' at the front edge, you should force the front
  153.                      lines down with a certain steepness-factor!
  154.                      The first value is the number of front lines you want to
  155.                      pull down (one line corresponds with one resolution-
  156.                      unit), the second value is the factor by which you want
  157.                      to enlarge the steepness. These values should be 
  158.                      obtained by trial and error. The two parameters are the
  159.                      slope-range (in lines) and the steepness factor.
  160.                      Example: Slope Front 30,5
  161.  
  162. Color                Sets the overall color of the surface. This color is
  163.                      specified by an RGB-vector. The components of the RGB-
  164.                      vector must be in the range 0..15! In current versions
  165.                      of FracTrace the vector should be 15,15,15, as there are
  166.                      still some problems with the ColourTrans module. Other
  167.                      values may be used, but the only way to display these
  168.                      created images correctly would be by '*ScreenLoad'ing
  169.                      them (ie. not with !Paint or !FracTrace itself). The 
  170.                      three parameters are the components of the RGB-vector.
  171.                      Example: Color 15,15,15
  172.  
  173. Var                  Sets (declares) the names for user-variables. See the
  174.                      paragraph 'Using frames' for further details on
  175.                      user-variables. This command takes up to 100 parameters,
  176.                      these being the names of the user-variables.
  177.                      Example: Var min,max,radius
  178.  
  179. Show                 Shows the contents of the specified variable in the
  180.                      'report' window. This command may be useful for 
  181.                      debugging script programs. The single parameter is the
  182.                      variable-name.
  183.                      Example: Show radius
  184.                                                            
  185.  
  186. Stop                 Immediately stops execution (ie. parsing) of an FTS
  187.                      file. When you use subroutines, a 'stop' should be
  188.                      put at the end of the main program, before the start
  189.                      of the first subroutine!
  190.  
  191.                               -----------------
  192.  
  193. The best way to get to know these commands and their effects is by 
  194. experimenting with the supplied FTS files. Try changing one parameter at a
  195. time and noticing the change in the according image(s).
  196.  
  197.  
  198. Using frames
  199. ------------
  200.  
  201. FracTrace provides a simple way to generate multiple images, called frames,
  202. from one FTS file. This is done by allowing the user to replace any 
  203. parameter by a variable or a constant expression. (The use of variables is
  204. recommended over the use of constant expressions!)        
  205. FracTrace allows the user to declare up to 100 user-variables. Declaration
  206. of a user-variable is as simple as including it in the so called 'var-list'
  207. at the beginning of a 'program'. This 'var-list' is just a list of names
  208. you choose for your variables, preceded by the 'var' command, 
  209. eg. : 'var count, loop, step, min, max', with the words after 'var'
  210. referring to user-variable names.
  211. These user-variables may be assigned any expression that is legal in
  212. BASIC V!
  213. There are also two other 'read-only' variables which the user may use in his
  214. expressions: 'frames' and 'frame'. The variable frames is the number of
  215. maximum frames set with the 'Frames' command. The other variable, frame, is
  216. the current frame number which the program is processing, which of course,
  217. is in the range 1..frames!
  218. Most user-variables will be defined by an expression containing the frame
  219. variable.
  220. There are two ways of assigning an expression to a user-variable:
  221.  
  222.       1) by using the form 'variable=expression(frame)' 
  223.          eg. : 'radius=60*SINRAD(frame)+100'
  224.          no spaces are allowed in the expression to the right of '=' !!!
  225.  
  226.       2) by using the form 'variable=expression,expression,expression,...'
  227.          eg. : 'height=12,23,34,45,56,67,78'    when frames would be 7
  228.  
  229. With the second form variable 'height' will be 12 for frame=1, 23 for
  230. frame=2, 34 for frame=3,..., and 78 for frame=7. Of course, expressions
  231. containing the variable frame (but no spaces!!!) may also be used in the
  232. second from!
  233.  
  234. People who know Render Bender will be familiar with this method.
  235.            
  236.  
  237. Conditional command execution
  238. -----------------------------
  239.  
  240. FracTrace also allows conditional execution of commands with the 'if .. else
  241. .. endif' construct!
  242. The use of this construct is as follows:
  243.  
  244.       if expression
  245.        commands
  246.           .
  247.           .
  248.       else
  249.        commands
  250.           .
  251.           .
  252.       endif
  253.  
  254. Where 'expression' is again any legal BASIC V expression evaluating to TRUE
  255. or FALSE, eg. 'frame+4 < frames' or 'xstep >= stepsize+0.2'.
  256. Each opening 'if' must have a closing 'endif', an 'else' is optional.
  257. The 'if .. else .. endif' constructs may be nested up to 32 levels deep!
  258.  
  259.  
  260. Repeated command execution
  261. --------------------------
  262.  
  263. a) The first loop-construct allowed in FracTrace is 'repeat .. until'.
  264.    It is used as follows:
  265.  
  266.       repeat
  267.        commands
  268.           .
  269.           .
  270.       until expression
  271.  
  272.    With 'expression' evaluating to TRUE or FALSE as in BASIC V,
  273.    eg. 'count > frames'.
  274.    Each opening 'repeat' must have a closing 'until'.
  275.    The 'repeat .. until' constructs may be nested up to 32 levels deep!
  276.  
  277.                
  278. b) The second loop-construct allowed in FracTrace is 'for .. endfor'.
  279.    It is used as follows:
  280.  
  281.       for variable=start to end by step
  282.        commands
  283.           .
  284.           .
  285.       endfor
  286.  
  287.    With 'start', 'end' and 'step' legal BASIC V expressions evaluating to a
  288.    real number, eg. 'for cnt=-3 to max by 2' or 'for size=2 to 1 by -0.1',
  289.    and 'variable' the name of a user-variable.
  290.    Each opening 'for' must have a closing 'endfor'.
  291.    The 'for .. endfor' constructs may be nested up to 32 levels deep!
  292.  
  293.  
  294. Execution of subroutines
  295. ------------------------
  296.  
  297. A last feature of FracTrace is the ability to execute subroutines.
  298. Each (part of a) subroutine is marked with a label, this label is a word
  299. preceded by a dot '.', eg. '.routine1'.
  300. Such subroutines are called in the following way:
  301.  
  302.       commands             \
  303.          .                  \
  304.          .                   \
  305.       call labelname          > main program
  306.          .                   /
  307.          .                  /
  308.       stop                 /
  309.  
  310.       .labelname            \
  311.        commands              \
  312.           .                   > subroutine 'labelname'
  313.           .                  /
  314.        return               /
  315.                                 
  316. As you can see, execution of a subroutine is started with a 'call' command,
  317. and ends with a 'return' command. Therefore, each 'call' MUST have a
  318. 'return'!!!
  319. The subroutine-calls ie. 'call .. return' may be nested up to 32 levels
  320. deep. (That includes recursion!)
  321.  
  322.  
  323. Writing programs
  324. ----------------
  325.  
  326. You will certainly have noticed from the last three paragraphs that it is
  327. possible to build small programs using the control constructs and variables
  328. provided by FracTrace. These programs don't have to define a fractal surface
  329. (they may do!), they can also be used to solve whatever - small - problem!
  330. The FTS files 'Factorial', 'Fibonacci', 'Sum50' and 'MandelPot' are some
  331. examples of such small programs.
  332.  
  333.                                                               Carl Declerck.
  334.