home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 2 / DATAFILE_PDCD2.iso / fractals / fractal107 / fractal_10 / _fractal / help / functions < prev    next >
Encoding:
Text File  |  1994-01-25  |  54.6 KB  |  1,304 lines

  1.   ________________________________________________________________________
  2.  /                                                                        \
  3. |                   !Fractal : Fractal Function Help                       |
  4. |                                                                          |
  5. |                           September 1993                                 |
  6.  \________________________________________________________________________/ 
  7.  
  8. Introduction
  9. ============
  10. This help file covers the various fractal and 3d transformers available
  11. within !Fractal and their associated parameters and menu options. Note: the
  12. 3d_Plane, 3d_View, Riemannn and Render options are not fractal functions,
  13. but take a fractal image and perform a 3d transformation. They are described
  14. after the fractal functions.
  15.  
  16. The algorithms where shown usually give only the core maths, omitting things
  17. like the scaling needed to handle zooming.
  18.  
  19. Most functions have a set of variables which are accessed from the
  20. Image->Data menu option or the Numbers tool icon. Normally the first four
  21. variables are for controlling the zooming and image positioning.
  22.  
  23. Fractals: A Brief Overview
  24. ==========================
  25. Typical characteristics of fractal images are:
  26.  
  27. a) They are generated by a mathematical formula which is repeated over and
  28. over (called iteration), usually feeding the results of the previous value
  29. into the next cycle, i.e. feedback. The formulae are usually fairly simple.
  30.  
  31. b) The resulting images are generated by plotting two of the resulting
  32. values like an x/y graph, often using the number of cycles as the colour.
  33.  
  34. c) The images contain an infinite amount of detail. As you zoom in yet more
  35. details unfolds.
  36.  
  37. d) Although of infinite detail, the patterns shown are usually very similar
  38. with just minor differences.
  39.  
  40. The types of plots generated fall into 3 main categories. Functions in the
  41. same category have the similar processing and colouring effects within
  42. Fractal.
  43.  
  44. Pixel Plots: Imagine your screen as an x/y plot on graph paper with each
  45. little square a single pixel colour of the screen. The function takes the
  46. value of x/y at each pixel and performs the iterative calculation, setting
  47. the pixel colour normally to the number of cycles taken before the result is
  48. greater or smaller than some predefined value. Pixel plot functions
  49. therefore plot each pixel of the screen. With Pixel plots the '3d Details'
  50. Effects panel allows you to plot in 3d or plot directly onto a Riemann
  51. sphere. To speed up plotting Fractal plots in several passes, guessing
  52. intermediate values where possible.
  53.  
  54. Point Plots: These functions take an initial value of x and y and then
  55. perform a calculation generating new values of x and y. A point is plotted
  56. for each set of x/y values. Colour is introduced by setting the plot style
  57. or by changing the colour after a certain number of plots - see the 'Plot
  58. Options' Effects panel to set these optons.
  59.  
  60. Line Plots: These functions operate in the same way as Point plots except
  61. that a line is drawn between each point. There are usually less points
  62. plotted than point plots making the use of lines a more feasible option.
  63.  
  64. Pixel Plot functions: Julia, Lyapunov, Mandelbrot, Newton, Quaternion, Unity
  65.  
  66. Point Plot functions: Bifurcate, Henon, IFS, Martin, Popcorn
  67.  
  68. Line Plot functions: L-System
  69.  
  70. 3d Plot functions: Lorenz, Pickover, Rossler. These are point or line
  71. plotting functions that use 3 values instead of 2. You can dynamically
  72. change the x/y/z axis whilst plotting by moving the cursor keys. Plotting is
  73. resumed by pressing space.
  74.  
  75. Other: CellFill, Fault, Midpoint, Plasma. All except CellFill can be used as
  76. 'Landscape' generators by processing the image via one of the 3d transform
  77. functions such as Render.
  78.  
  79. --------------------------------------------------------------------------
  80.  
  81. Bifurcate
  82. ---------
  83. !Fractal would not be complete without bifurcation diagrams, one of the
  84. original manifestations of chaos. They were originally discovered from a
  85. very simple equation to describe animal populations:
  86.  
  87.     New Population = Growth Rate * Old Population * ( 1 - Old Population)
  88.  
  89. where population is a value between 0 and 1. With growth rates < 200% a
  90. single line results, over 200% it splits (bifurcates) into 2, then 4, then
  91. becomes chaotic. In the plot the x-axis is the growth rate, the y-axis is
  92. the population.
  93.  
  94. Bifurcate plots points, the colours of which are set from the main Plot
  95. Options dialogue box in the Effects menu. For best results set Initial
  96. Colour=0 and Plot Type to 'Subtract' so that where multiple points are
  97. plotted at the same pixel, the colour is decremented.
  98.  
  99. The data values for Bifurcate are:
  100.  
  101. Growth Rate: value at x0.
  102. Pop. Size  : value at y0.
  103. Rate Range : add to x0 to give growth rate at far right.
  104. Pop. Range : add to y0 to give population at top of screen.
  105. Init Popn. : The inital value of the population used in the equation.
  106. Max Gen.   : Number of generations to calculate for each growth rate.
  107. Min Gen.   : Number of generations before plotting.
  108.  
  109. The Min Gen value is used as a low filter to let the population stabilise
  110. before plotting, whilst the Max Gen is the total number of generations to
  111. calculate before moving onto the next growth rate.
  112.  
  113. You can zoom in to examine the chaotic patterns, which often reveal detail.
  114. Increase Max Gen as you zoom in to see the range of population values.
  115. !Fractal switches from fast 32 bit to full floating point calculations as
  116. you zoom in.
  117.  
  118. There are many formulae that lead to bifurcation diagrams. There are several
  119. to choose from the menu - the 'R' in the equation is the growth rate.
  120. Mitchel Feigenbaum discovered that the ratios of lengths of adjacent areas
  121. of bifurcation were always 4.6692..., a constant that is now named afer him.
  122.  
  123. --------------------------------------------------------------------------
  124.  
  125. CellFill: A Space Filling Cellular Automata
  126. ========
  127. This function is a bona-fide flood fill algorithm based on a cellular
  128. automata. It creates an amazing textured pattern that is beautiful in its
  129. own right, or which may be combined with other fractals to fill in the
  130. background eg. L-Systems. The initial fill points (live cells) can be
  131. specified from the menu or set by the mouse. Each cell then grows randomly
  132. in each direction until there are no adjoining unfilled cells. The strange
  133. pattern results from using different colours depending in which direction
  134. the new cell was filled.
  135.  
  136. An unfilled cell is one in the colour at the initial cell position. By using
  137. mouse selection you can specify where the initial point is and thus the
  138. colour to be filled.
  139.  
  140. The textures created can look like terrains, crumpled paper, bark, metal
  141. foil, rock faces etc, depending on the colours and initial pattern. Try
  142. different display palettes and the palette adjust facility. See the
  143. MandyGold and Pop_Fill scripts for ideas. Note that the L-System fill calls
  144. this function, so the following settings take effect there as well.
  145.  
  146. Data Items: The first 4 items specify the fill colour when converting an
  147. empty (black) cell. The directions are relative to the cell being processed.
  148. The Die colour specifies the value to be added to the cell that created a
  149. new cell (-255 to 255, 0 for no change). The Draw Colour is the value to use
  150. when using mouse selection. All colour values are physical colour numbers
  151. (0-255) - use !EditPal to see what they look like.
  152.  
  153. Menu Items: The From submenu allows the setting of the initial fill points -
  154. the corners or centre of the image. Alternatively Mouse Select allows you to
  155. choose your own start points - see below. The Presets submenu leads to a
  156. selection of preset colour values to get you going - the colours assume you
  157. are using the Default palette.
  158.  
  159. Mouse Select: When on this allows you to specify the initial fill cells. It
  160. may be combined with the preset cells. Press Redraw then press Select at the
  161. points where you want to fill from - the point will be temporarily set to
  162. the Draw Colour to show it has been selected. To end selection, press Menu,
  163. and the shape will be drawn. To create terrains draw lines corresponding to
  164. where you want the ridges. To create a volcano, draw a circle. If you press
  165. Adjust then the point is drawn but does not become an active cell. This
  166. allows you to draw barriers to enclose or alter the fill pattern.
  167.  
  168. Hints On Colouring: A good way to think of the colour schema is to imagine a
  169. point of light coming from one side. Set this side to the brightest colour,
  170. the opposite side to the darkest, and the two perpendicular sides to
  171. in-between shades. For the preset colours, the light comes from top right.
  172. Set the Draw Colour to one of the fill colours so that your outline shape
  173. merges with the fill colour.
  174.  
  175. By setting a fill colour to the initial cell colour (eg. 0) you effectively
  176. stop growth in that direction, which can lead to other interesting effects
  177.  
  178. Algorithm: A set of initial points are chosen as the live cells. A cell is
  179. then chosen at random from this set and the adjacent cells inspected. If not
  180. set (colour=initial cell colour) then the cell is coloured depending whether
  181. it is above, below, left or right of the chosen cell. These new cells are
  182. added to the set of live cells. The original cell is then killed, changing
  183. its colour by the 'Die colour' value. The process is repeated until all
  184. cells are dead.
  185.  
  186. It is possible to extend this algorithm to handle all 8 surrounding cells
  187. rather than 4, the result being a much smoother display especially when
  188. using shading colours. I've stuck to 4 because it is easier to choose 4
  189. suitable colours.
  190.  
  191. My thanks to Jean Van Mourik for this algorithm.
  192. Nb. This function works best in modes with square pixels, eg. Mode 21 or 13.
  193.  
  194. --------------------------------------------------------------------------
  195.  
  196. Fault
  197. -----
  198. Generates a landscape by a very simple simulation of geological faulting,
  199. showing the result as a contour map. Each time a fault occurs, a part of the
  200. landscape is moved up (or down). By repeating the process hundreds or
  201. thousands of times at random locations across the image, an uneven terrain
  202. is created. The portion of the terrain faulted is determined by the fault
  203. type selected by Fault->Type. All but Linear are based on shapes, where the
  204. region within the shape is faulted upwards or downwards. The position of the
  205. fault shape is chosen at random.
  206.  
  207. For Linear faulting, a line is chosen at random across the image, then one
  208. side is faulted downwards or upwards. The initial image is at a set level
  209. to accomodate downward faults. Linear faults look best when plotted in 3d
  210. rather than as a contour map.
  211.  
  212. The data parameters are:
  213.  
  214. No. Faults: the number of faults to be run before stopping. Higher numbers
  215. produce more realistic and uneven shapes.
  216.  
  217. Shape Size: The size of the fault shape in OS units. Larger sizes tend to
  218. produce more generalised faults but may lead to obvious boundary lines which
  219. can look unrealistic. Smaller shapes give more uneven, bumpy landscapes.
  220. Sizes of 1/5th the total image give a good balance between smoothness and
  221. variety. Larger shapes will take longer to plot. Not used for Linear faults.
  222. The size is limited by memory.
  223.  
  224. Step: The maximum height increment for each fault. The maximum height that
  225. can result is 255 unless Fault->Wrap is turned on in which case heights wrap
  226. around to 0. For 3d shapes such as Cone and sprites, the Step represents the
  227. maximum height (usually the centre).
  228.  
  229. Base Level: A value 0-255. For Linear faults or when using Up/Down faulting,
  230. this sets the initial level (128=middle). Change this value to alter the
  231. "sea level" or bias towards low or high levels.
  232.  
  233. Seed: The random number used as a seed to generate the landscape. To
  234. recreate a landscape, set Fault->Random off and set the seed value. This
  235. allows the effects of different shapes, sizes and step values to be
  236. evaluated.
  237.  
  238. From the Fault menu the following options are selectable:
  239. Type: leads to a submenu showing the type of fault to use. The first set are
  240. shapes, the size of which is set from the data value Shape Size, and maximum
  241. height by Step.
  242.   Circle    : a circle of radius Shape Size/2.
  243.   Cone      : a conic rising evenly in height (max Step) to the centre.
  244.   Hexagon   : a hexagon of radius Size/2.
  245.   Octagon   : an octagon of radius Size/2.
  246.   Octagon 3d: a 3d octagon rising in height to the centre.
  247.   Sprites   : leads to a panel listing a sprite shape to be used as the
  248.               fault pattern. Click on Sprite to use this feature, and click
  249.               on the name of the sprite to use.
  250.   Linear    : Uses linear faulting rather than by shape. When Random Step is
  251.               on, the Step size is the maximum, rather than the actual amount.
  252.  
  253. Random: when on generates a random landscape. Turn off to recreate a
  254. landscape using the Seed value.
  255.  
  256. Wrap: when on allows height values to wrap around from 255 to 0, otherwise
  257. values peak at 255.
  258.  
  259. Up/Down: when on faults are made randomly upwards or downwards, otherwise
  260. only upwards faults are made. When off, using a lot of faults will cause the
  261. image to end up as all high, so setting this on will help to keep heights
  262. between 0 and 255. Linear faults are always made in Up/Down mode.
  263.  
  264. Using Sprite Fault Shapes
  265. -------------------------
  266. Any shape can be used as the fault pattern. The colour values of the sprite
  267. are used as the relative fault height, whilst the overall size of the sprite
  268. is set by Shape Size as for other shapes. The supplied sprites are in the
  269. file FaultSpr (see Misc->Resources).
  270.  
  271. You can experiment with your own shapes by dragging a sprite file onto any
  272. of !Fractal's windows whilst Fault is selected. The sprites must be defined
  273. in a 256 colour mode - 13 and 21 are best since the pixels are square. Each
  274. sprite should be square in terms of OS units, but the pattern inside can be
  275. any shape.
  276.  
  277. It is best to draw the pattern in distinct colours since the low colour
  278. values are difficult to see. Treat each colour number as a relative height
  279. value. At plot time the maximum colour is set to the value of Step and the
  280. other colours are scaled accordingly. Circular patterns tend to give the
  281. most realistic landscape effect, but feel free to experiment since strange
  282. patterns can be produced with linear shapes. You can think of Fault as a
  283. special type of Tiling mechanism.
  284.  
  285. Hints And Tips
  286. --------------
  287. Faulting with shapes works best with a thousand or more faults with a shape
  288. size of 100-200. With 3d shapes use a higher step than normal. With Linear
  289. faulting try 400 faults with a step value of 8. With Random Step off, each
  290. fault is of the same size. Linear faults look better once transformed into
  291. 3d, since this removes some of the linear effect.
  292.  
  293. The resulting image looks best with the Landscape display palette. If the
  294. image is too low you'll just see blue, so use the Palette adjust facility
  295. (striped Tool icon) to alter the mapping until you get a mixture of sea and
  296. land. Alternatively load your own customised palette made with !EditPal. For
  297. instance, a palette of various shades of white, grey and light blue give a
  298. very realistic cloud effect.
  299.  
  300. To view the landscape in 3d try 3d_View or Render using either a Log or
  301. Linear 3d mapping (in the 3d panel). Use the 3d Scalar value to accentuate
  302. or smooth the image. Again, select the Landscape palette. Try the Riemann
  303. plot to create your own globe.
  304.  
  305. Try composite faults by turning off Image->Redraw->Clear. This allows
  306. different shapes, sizes and step values to be cumulatively applied. When
  307. creating composite images it is best to start with a large shape size,
  308. running for several hundred faults, to generate the basic rolling terrain.
  309. Then use a smaller fault size, increase the number of faults and step size
  310. to give more localised variation and peakiness. The best shapes are the Cone
  311. and Octagon 3d - for these you'll need a relatively larger size than Circle
  312. because of the gradual rise in height. Try mixing shapes to create different
  313. effects - eg. start off with Linear, then switch to cone to smooth the
  314. image. Using large shape sizes can also produce interesting patterns.
  315.  
  316. Faulting by shape is a variation on tiling, and many images can be created
  317. by using the function in this manner rather than for landscape generation.
  318. Try colour cycling (especially with a single colour) with an image created
  319. with a few faults and large shape size.
  320.  
  321. Scripts
  322. -------
  323. Use !Fractal's script facility to create images from composite faults. See
  324. the Misc->Resources directory for sample scripts. This is a very powerful
  325. facility which allows complex patterns to be created.
  326.  
  327. Algorithm
  328. ---------
  329. Faulting by shape simply involves selecting a point at random and then
  330. plotting the shape centred on that spot. The value of each shape pixel is
  331. added to the image pixel value - if Fault->Wrap is off, then the maximum
  332. value of 255 is set, otherwise the value wraps around.
  333.  
  334. With Linear faulting, two co-ordinates on 2 different sides are chosen at
  335. random. One side is faulted down or up (both chosen at random). If the
  336. height is <0 or >255 then it is wrapped inwards.
  337.  
  338. --------------------------------------------------------------------------
  339.  
  340. Hénon Maps : An implementation of Hénon's strange attractor.
  341. ----------
  342. Two sub-functions are provided. The Original function shows a simple orbit,
  343. whilst the SIN/COS function is a fuller implementation. They both relate to
  344. orbits of asteroids and so on.
  345.  
  346. Henon plots points, the colours of which are set from the main Plot Options
  347. dialogue box in the Effects menu.
  348.  
  349. The menu options are greyed when not applicable to a particular function.
  350. The menu options are:
  351.  
  352. Original: selects the basic function. This function is infinite so you will
  353. need to manually stop it. See Chaos by J.Gleick p.141 for full details.
  354.  
  355. SIN(a)/COS(a): selects the full function. See J.Dewdney, Sc.American, July
  356. 1987.
  357.  
  358. Random a: The value of a is chosen at random by the program when ticked.
  359. Random b: The value of a is chosen at random by the program when ticked.
  360.  
  361. Auto Step: When on, the number of points calculated will be increased as you
  362. zoom in, to give greater resolution, though this will take longer.
  363.                                                          
  364. Original Algorithm:
  365. ------------------
  366. The default value for a is 1.4 and b is 0.3. The best
  367. results come from slightly altering these values rather than choosing random
  368. figures.
  369.  
  370.    px=1
  371.    py=1
  372.    do
  373.        z=px
  374.        px=py+1-a*z*z
  375.        py=b*z
  376.        plot px,py
  377.    until (x>1.0e10 or y>1.0e10)
  378.  
  379. SIN(a)/COS(a) Algorithm:
  380. -----------------------
  381. Here the main control is the data variable a. The step rate is decreased
  382. when zooming in. Thanks to Joyce Haslam for passing on this algorithm.
  383.  
  384.    for i=-0.8 to 0.8 step 0.05
  385.      for j=-0.8 to 0.8 step 0.05
  386.        c=0; x=i; y=j
  387.        repeat
  388.          c+=1
  389.          xx=x*COSa-(y-x*x)*SINa
  390.          y=x*SINa+(y-x*x)*COSa
  391.          x=xx
  392.          plot x,y
  393.        until (i>100 or x>1000 or y>1000)
  394.      next
  395.    next
  396.  
  397. --------------------------------------------------------------------------
  398.  
  399. IFS 2d: An implementation of Michael Barnsley's IFS system in 2 dimensions.
  400. ------
  401. Up to 40 IFS transformations are stored internally, one of which is the
  402. working IFS.
  403.  
  404. IFS plots points, the colours of which are set from the main Plot Options
  405. dialogue box in the Effects menu.
  406.  
  407. From the IFS menu the options are:
  408.  
  409. Data: The current IFS data except for the zooming co-ordinates which are
  410. accessed via the standard Image⇨Data⇨ menu. Click Input to enter new values,
  411. or Re-draw to enter and re-draw the image. Click Store to store the data in
  412. the internal file, or Restore to revert to the version held internally.
  413. Click Copy to take a copy of the current data and create a new IFS function,
  414. or click Delete to delete the current entry.
  415. The data on display consists of:
  416.  
  417. Name: used to identify the IFS function, any 1-11 characters.
  418.  
  419. Number: location within the internal IFS file. Click on the arrows to access
  420. prior or next entries.
  421.  
  422. Transformations: number of affine transforms to use (1-20). If the sum of
  423. the probabilities is less than 1, this number is automatically increased by
  424. 1 and a null transformation is added.
  425.  
  426. Iterations: The number of iterations before stopping image generation.
  427.  
  428. The affine data is shown according to its place in the affine function, not
  429. as a,b,c... as shown in some programs, so be careful when porting values.
  430. The sum of the probabilties must be >=1. If not, an extra null
  431. transformation is added. To move around the grid use !Fractal's standard
  432. editing keys. Numbers may be entered in scientific format. Remember to click
  433. Input or Re-draw afterwards to get the new values processed. Only the first
  434. 9 values are shown. If a function has more (such as Chaos) then use !Edit to
  435. edit the IFS data file & reload into Fractal.
  436.  
  437. List: shows a panel listing all the internal IFS functions available. Click
  438. over a name to make it the current one. Most of these came from Fractint, so
  439. see there for credits.
  440.  
  441. Save: allows the internal IFS file to be saved as a text file. Saved files
  442. can be re-loaded by dragging onto the !Fractal icon or window. Please send
  443. in exciting new IFS functions to AFG so that we may all see them.
  444.  
  445. Algorithm
  446. ---------
  447. The algorithm to generate each point is essentially as shown on the input
  448. panel, ie:
  449.  
  450.   r=random number from 0 to 1
  451.   select affine transformation whose probability sum is just less than r
  452.   x=a*x+b*y+c
  453.   y=d*x+e*y+f
  454.   plot x,y
  455.  
  456. where a..f refer to the columns in the data input panel left to right.
  457.  
  458. --------------------------------------------------------------------------
  459.  
  460. Julia Set
  461. ---------
  462. Plots the Julia set corresponding to the equivalent Mandelbrot function.
  463. The initial zoom uses integer maths, then reverts to to a rather slower
  464. floating point. From the menu you can switch to the equivalent Mandelbrot -
  465. the current Real and Imaginary values are used to set the Mandelbrot x & y
  466. value for the centre of the image. Other options are as described under
  467. Mandelbrot.
  468.  
  469. It is usually best to select a Julia from the equivalent Mandelbrot display.
  470. Trying to set cReal and cImaginary otherwise can be a slow process to get
  471. reasonable results. When switching to the Quaternion set, Quaternion q0 is
  472. set to cReal & q2 to cImaginary.
  473.  
  474. When using functions other than Square, floating point is used much sooner
  475. so as to maintain accuracy.
  476.  
  477. Algorithm: the Julia algorithm is essentially the same as for Mandelbrot,
  478. but with a different start point, namely:
  479.  
  480.   u=x
  481.   v=y
  482.   x=cReal
  483.   y=cImaginary
  484.  
  485. --------------------------------------------------------------------------
  486.  
  487. Lorenz : The Edward Lorenz Strange Attractor.
  488. ------
  489. This was probably the first fractal to be recognised as such, and started
  490. the ball rolling for chaos investigation. The shape is three dimensional and
  491. you can use !Fractal's rotation and elevation icons to control the view
  492. position. There are three variables which may be set or randomly chosen, and
  493. there are three colour schemes. Refer to Chaos by J.Gleick for a description
  494. of the story behind its discovery. 
  495.  
  496. The plot is infinite. You can control the speed by setting the Step Rate
  497. factor - smaller values will slow the plot so you can trace its shape.
  498. Notice that the plot revolves around one centre and then suddenly jumps
  499. across to the other.  Try altering the default values of a/b/c by small
  500. amounts and see the effect this has on the shape and when the jump occurs.
  501.  
  502. The menu options are:
  503.  
  504. Random a/b/c: Click to set/unset random selection of the variable when a
  505. plot is started. For each variable there is an associated maximum, which can
  506. be changed from the data panel. New variables are not chosen when zooming.
  507. Once you have found an interesting shape, turn off random variables, and use
  508. the 3d options to explore the shape.
  509.  
  510. Random colour: when set a random colour is chosen after every 100 plots.
  511.  
  512. Step Colour: the colour value is increased after every 100 plots.
  513.  
  514. If neither Random or Step colour is set, then the plot is made in white
  515. using exclusive or'ing to trace the current position.
  516.  
  517. You can change the viewpoint whilst plotting by pressing the cursor keys,
  518. and then pressing the space bar to restart. See the 3d section in the
  519. !MainHelp file for more details. Try Step Rate=2.0e-2 for the best use of
  520. this function - note that bigger values destroy the shape.
  521.   
  522. Algorithm
  523. ---------
  524.   x=1; y=1; z=1;
  525.   do forever
  526.      dx=a*(py-px)
  527.      dy=px*(b-pz)-py
  528.      dz=px*py-c*pz
  529.      px+=dx*step_rate
  530.      py+=dy*step_rate
  531.      pz+=dz*step_rate
  532.      draw px,pz           where px/pz are 3d transforms of x/y/z
  533.   enddo
  534.  
  535. --------------------------------------------------------------------------
  536. Lyapunov
  537. --------
  538. This function is a development of the Verhulst equation (similar to the
  539. Bifurcation algorithm) used to model population growth. The Lyapunov
  540. exponent is the average of the population size over a series of iterations.
  541. In the display the x and y axis represent different rates of growth. For
  542. each pixel the Lyapunov exponent is calculated, using the x or y value each
  543. iteration. Which value of x or y is chosen is set by the Sequence variable:
  544.  
  545.   xyx - means use x, then y, then x, then repeat the sequence.
  546.  
  547. The algorithm used is as follows:
  548.   
  549.   x=initial population, usually 0.5, but between 0 and 1
  550.   for i=1 TO initial_iteration_limit
  551.     R=x or y depending on sequence
  552.     x=R*x*(1-x)
  553.   next
  554.   L=0
  555.   for i=1 TO iteration-limit
  556.     R=x or y depending on sequence
  557.     x=R*x*(1-x)
  558.     r=R*(1-x-x)
  559.     L=L+LOG(ABS(r))
  560.   next
  561.  
  562. The value of L is used to set the screen colour. Solid areas tend to be
  563. those where the value of x remains stable (negative L), whereas dotted areas
  564. tend to be chaotic ones.
  565.  
  566. The data panel lets you set the values of the iteration limits, the initial
  567. population and the sequence of x or y values. Note that the value of x and y
  568. (ie. R) must lie within the range 0 to 4, with the range 3 to 4 usually
  569. providing the best values.
  570.  
  571. To change the shape of the image use different x/y sequences - use the menu
  572. to select different preset images as a starter. To see the image at its best
  573. you will need to experiment with different palettes, such as the Lyapunov
  574. ones. Full 256 colours helps a lot since it is difficult to get a good
  575. palette using the RiscOS fixed palette. Interesting 3d effects are possible.
  576.  
  577. The image takes quite a while to generate even though fast integer maths is
  578. used throughout. From the menu you can choose between 16 and 32 bit maths.
  579. Use the latter for better image quality with some loss of speed. You will
  580. find that the amount of zooming is fairly limited but in general this does
  581. not matter since detailed close ups tend to repeat the overall picture.
  582.  
  583. You can use Lyapunov with 3d and Riemann sphere plotting methods.
  584.  
  585. For more information see the article "Leaping Into Lyapunov Space" by
  586. A.K.Dewdney in the Scientific American Sept 1991 and Fractal Report 21 which
  587. gives a simple BBC Basic version.
  588.  
  589. --------------------------------------------------------------------------
  590.  
  591. Mandelbrot
  592. ==========
  593. The classic fractal, supplied here in 9 different flavours. Thanks to Joyce
  594. Haslam and Michael Rozdoba for providing the maths for the enhanced versions.
  595.  
  596. The initial zoom uses integer maths, then switches to floating point
  597. routines. The point at which the switch occurs depends on the zoom level and
  598. whether you have an FPA chip. Without an FPA, the floating point routines
  599. will unfortunately be very slow.
  600.  
  601. Level Set, Continuous Potential and Distance Estimator Methods
  602. --------------------------------------------------------------
  603. Three methods of calculating Mandelbrots are provided. The Level Set method
  604. (LSM) is the one seen in most other Mandelbrot generators. LSM creates a
  605. stepped image, resulting from plotting the number of iterations it takes
  606. before the function tends to infinity. The Continuous Potential method (CPM)
  607. is calculated in a similar way except that the colour plotted is dependant
  608. on the value of the result, resulting in a much smoother transition of
  609. colours which can look very professional.
  610.  
  611. CPM requires use of floating point and so will be slow without a maths
  612. coprocessor. You will normally need to set Limit to a value >500 to get a
  613. smooth transition, and will need to experiment with the Slope value to get a
  614. good colour mapping. You will also need to use a palette that has smooth
  615. transition of colours, such as Grey256 or Landscape2, and of course a
  616. graphics board of showing these to their best! Alternatively try the Black &
  617. White palette for an interesting Moire pattern.
  618.  
  619. CPM also looks good in 3d Mandelbrots since it gives a much smoother
  620. terrain. See the Script file MountMandy for an example. The image generated
  621. is similar to that seen in books like "The Science Of Fractal Images".
  622.  
  623. The Distance Estimator Method (DEM) enhances detection of the boundary
  624. region of the Mandelbrot set. Normally for each pixel we calculate whether
  625. that point is in (result tends to 0) or outside (result tends to infinity)
  626. of the Mandelbrot set. Since there is so much detail within the set it is
  627. easy to miss an interior point near the boundary since we are dealing with
  628. discrete values at each pixel location. The DEM overcomes this by looking
  629. either side of the current pixel in fractional amounts (ie. less than a
  630. pixel's width) to see if an interior region is present. The distance we look
  631. either side is set by the Threshold parameter - smaller values limit the
  632. search.
  633.  
  634. When using DEM on the standard Mandelbrot plot you will notice it displays
  635. extended fine filaments. If you zoom in you will find these filaments are
  636. very fine indeed, requiring a lot of zooming to obtain resolution. The
  637. benefit of DEM is that these boundary regions are where all the interesting
  638. shapes are, so using DEM allows you to see these potential locations at low
  639. magnifications.
  640.  
  641. To use DEM you need to turn off X/Y Guessing (in the Misc->Options panel)
  642. since we need to calculate the values at each pixel and cannot guess their
  643. values. It is also useful to set Min_Iter=Max_Iter so that only the boundary
  644. is plotted, and Colour=255 to display the interior in white. As you zoom in
  645. it will be necessary to increase the value of Overflow - if it is too low
  646. the boundary line becomes distorted.
  647.  
  648. DEM requires a lot more computation than the other techniques so it is
  649. slower. Also DEM requires 24*Max_Iter bytes for workspace, so be careful on
  650. high iterations. You can combine the DEM and CPM techniques.
  651.  
  652. Data Values
  653. -----------
  654. x0, y0, width and height: the co-ordinates in the real & imaginary plane.
  655.  
  656. Max Iter: the bailout value. If the value of Limit has not been reached
  657. after Max Iterations, then the calculation is stopped, assuming the interior
  658. of the set has been reached. High Max Iter values will slow down plotting
  659. but increase detail, and becomes necessary as you zoom in. DEM requires
  660. 24*Max_Iter bytes for workspace.
  661.  
  662. Min Iter: if the calculation stops prior to Min Iter then the point will not
  663. be plotted. Setting Min Iter allows exclusion of low iteration colour
  664. values. With LSM, for iterations > Min Iter, the colour is set to
  665. Iter-Min Iter to extend the colour range into higher iterations. Set
  666. Min Iter=Max Iter to only plot the interior. 
  667.  
  668. Limit: when the value of the function exceeds Limit the calculation is
  669. stopped. The default value of 4.0 is sufficient for the Level Set method and
  670. is hard wired into the integer routines. For the Continous Potential method
  671. values >500 are required to get smooth transitions between values.
  672.  
  673. Slope: used to transform the potential value when using CPM into a colour
  674. number. As you zoom in and increase Max_Iter you will need to increase the
  675. Slope - unfortunately there is no easy way to calculate the best value for
  676. you. Altering slope alters the spread of colours across the potential.
  677.  
  678. Max Colour: used in CPM mode, it sets the maximum logical colour to plot.
  679. Normally this will be 255 but higher values allow a greater range of
  680. gradients at the expense of colours wrapping around.
  681.  
  682. Threshold: a value 0-1.0, used in DEM mode. It specifies the fraction of a
  683. pixel to examine for the interior of the set. If it is too low no extra
  684. detail is shown, whilst if it is too high the filaments become too wide,
  685. resulting in lost detail. This parameter needs modifying depending on
  686. function, Max Iter, Limit, Mandelbrot or Julia_Set, which is why this
  687. parameter cannot be set automatically.
  688.  
  689. Overflow: This is the DEM equivalent to Limit. Lowering Overflow makes the
  690. point more likely to be considered as part of the interior - if too low then
  691. this estimate can get inaccurate. As you zoom in it will be necessary to
  692. increase this value in fairly large steps, eg from 1e8 to 1e9 and so on.
  693.  
  694. 3d Plotting
  695. -----------
  696. Mandelbrots and Julias can be drawn directly in 3d by turning on the 3d X/Y
  697. Plot option. Use the Linear height transform. See the 3d section of
  698. !MainHelp for details.
  699.  
  700. Menu Options
  701. ------------
  702. Julia Set: switches to the equivalent Julia set. Moving the mouse changes
  703. the Real (x) and Imaginary (y) values as shown on top of the screen. Press
  704. select to generate the fractal. The best places to choose are along the
  705. Mandelbrot boundary. After seeing the Julia image you can jump back to the
  706. Mandelbrot by using Display->Previous if you have only drawn the Julia once.
  707.  
  708. Quarternion: switches to the equivalent Quaternion map in a similar way to
  709. above. The selected x values becomes q0 and y -> q2 in the Quaternion set.
  710.  
  711. Function: 9 different Mandelbrot functions: square, cubic, quartic,
  712. Bruce Ikenaga's function, a function discovered by Ushiki called Phoenix,
  713. Quazi (a variant of square), and Inverse square, cubic and quartic.
  714.  
  715. Method: selects Continuous Potential and/or Distance Estimator methods of
  716. colouring.
  717.  
  718. Infill: provides 5 different colouring options for the interior. Colour
  719. allows the interior to be set to any of the 256 colours - enter the value
  720. 0-255 in the menu entry provided. Max. Iter uses the value of Max Iter as
  721. the colour. The other 3 generate a colour based on the last iterated value
  722. of z.
  723.  
  724. Period Checking: This is a technique that attempts to predict whether a
  725. point is in the interior of the set or not. The aim is to save calculation
  726. time at high iteration levels (>200). At low iteration levels the mechanism
  727. can slightly slow the calculations, so the option is provided to allow you
  728. to turn it off. NOTE: this option currently only refers to the floating
  729. point routines.
  730.  
  731. Accuracy
  732. --------
  733. Various levels of accuracy are used to give the fastest possible plot. The
  734. accuracy is determined by calculating delta=width/x_pixels. Assuming
  735. x_pixels=640 which it is in most modes, the following table shows the switch
  736. over points:
  737.  
  738. Delta>   Width
  739. 2.5e-4   0.16    : 16 bit fixed point
  740. 2.0e-8   1.28e-5 : 32 bit fixed point, but not if FPA fitted.
  741. 2.5e-7   1.6e-4  : 32 bit floating point if FPA fitted.
  742. 4.4e-16  3.0e-13 : 64 bit limit of accuracy.
  743. 2.2e-19  1.4e-16 : 96 bit limit of accuracy. Only used by z=z²+c routine.
  744.  
  745. In practice the 64/96 bit limits start to become apparent before those
  746. given. When nearing the maximum resolution (width<1.0e-15) turn off X/Y
  747. Guessing in the Misc->Options panel - for some reason this technique is
  748. currently interfering with the display. Also note that the x/y cordinates
  749. can only be set using 64 bit accuracy, so zooming will become imprecise at
  750. full 96-bit resolution. At maximum resolution the Mandelbrot image is 1000
  751. times the distance between the Earth and Sun, so don't complain!
  752.  
  753. Algorithms
  754. ----------
  755. For each pixel we calculate the x & y value and then iterate. For LSM The
  756. colour is the iteration number unless uu+vv>4.0, when we set the colour to 0
  757. (or as set by the Interior menu option). To speed up processing periodicity
  758. checking is employed to detect when near the interior of the image - this is
  759. where the values of u & v settle down to a set pattern.
  760.  
  761. For CPM the colour is computed as:
  762.   colour=Max_Colour-sqrt(log(uu+vv)/2^iter)*slope
  763.  
  764. For the DEM algorithm, see p198 of "Science Of Fractal Images".
  765.  
  766. Square: z=z*z+c
  767.   iter=0
  768.   u=0; v=0;
  769.   repeat
  770.     uu=u*u;
  771.     vv=v*v;
  772.     m=uu-vv+x
  773.     v=u*(v+v)+y
  774.     u=m
  775.     iter+=1
  776.   until (iter>maxiter or uu+vv>4.0)
  777.  
  778. Cubic: z=z*z*z+c
  779.   iter=0
  780.   u=0; v=0;
  781.   repeat
  782.     uu=u*u;
  783.     vv=v*v;
  784.     u=uu*u-3*u*vv+x
  785.     v=3*v*uu-vv*v+y
  786.     iter+=1
  787.   until (iter>maxiter or uu+vv>4.0)
  788.  
  789. Quartic: z=z*z*z*z+c
  790.   iter=0
  791.   u=0; v=0;
  792.   repeat
  793.     uu=u*u;
  794.     vv=v*v;
  795.     m=uu*uu+6*uu*vv+vv*vv+x
  796.     v=4*u*v*(uu-vv)+y
  797.     u=m
  798.     iter+=1
  799.   until (iter>maxiter or uu+vv>4.0)
  800.  
  801. Ikenaga:
  802.   iter=0
  803.   u=0; v=0;
  804.   repeat
  805.     uu=u*u;
  806.     vv=v*v;
  807.     m=u*(uu-3*vv+x-1)-v*y-x
  808.     v=v*(3*uu-vv+x-1)+u*y-y
  809.     u=m
  810.     iter+=1
  811.   until (iter>maxiter or uu+vv>4.0)
  812.  
  813. Phoenix:
  814.   iter=0
  815.   u=0; v=0; ux=0; uy=0
  816.   repeat
  817.     uu=u*u;
  818.     vv=v*v;
  819.     m=2*u*v+y*vx
  820.     n=uu-vv+x+y*ux
  821.     ux=u
  822.     vx=v
  823.     u=m
  824.     v=n
  825.     iter+=1
  826.   until (iter>maxiter or uu+vv>4.0)
  827.  
  828. Quazi:
  829.   iter=0
  830.   u=0; v=0;
  831.   repeat
  832.     uu=u*u;
  833.     vv=v*v;
  834.     m=uu-vv;
  835.     if (m<0) r=-m;
  836.     m=m-x;
  837.     v=u*v;
  838.     v=v+v-y;
  839.     u=r;
  840.     iter+=1
  841.   until (iter>maxiter or uu+vv>4.0)
  842.  
  843. Inverse:
  844.   r=x*x+y*y
  845.   x=x/r
  846.   y=y/r
  847.   then as per Square/Cubic/Quartic
  848.  
  849. --------------------------------------------------------------------------
  850.  
  851. Martin Map: uses the algorithm of Dr. Martin.
  852. ----------
  853. Change the values of a, b or c to get different patterns. The zoom option
  854. does not give more detail, but allows the size and position of the image to
  855. be changed. The routine is infinite, so you will need to select Stop to end
  856. the plot.
  857.  
  858. Martin plots points, the colours of which are set from the main Plot Options
  859. dialogue box in the Effects menu. Choose Random plotting for best effects.
  860.  
  861. From the menu you can select whether a, b or c are set randomly. Due to the
  862. way the algorithm works it is not possible to guess the size or position of
  863. the resulting image. New variables are not chosen when zooming.
  864.  
  865. For each variable there is an associated maximum for the random number,
  866. which can be changed from the data panel.
  867.  
  868. Algorithm:
  869.    xx=py-sign(px)*sqrt(abs(b*px-c))
  870.    py=a-px
  871.    px=xx
  872.    plotpoint(px,py)
  873. where px,py start off at 0.
  874.  
  875. --------------------------------------------------------------------------
  876. Midpoint
  877. --------
  878. The midpoint displacement algorithm is one of the simplest used to generate
  879. fractal landscapes. Start with a square and randomly choose the heights of
  880. each corner. Divide this square into smaller ones and set the height of each
  881. unplotted corner to the average height of the surrounding points, +/- a
  882. random displacement. This process is repeated until we reach a unit
  883. square. As we proceed the maximum displacement is reduced proportionately.
  884.  
  885. Starting with just 4 random points produces a smooth rolling landscape. To
  886. get a more varied landscape more of the squares are plotted with random
  887. heights prior to performing the midpoint displacement. For more information
  888. see The Science Of Fractals, especially p96.
  889.  
  890. Menu Options
  891. ------------
  892. Random: when on a different landscape is plotted. Set to off to allow
  893. re-generation of a landscape with changes in the data variables.
  894.  
  895. There are 5 data variables that can be used to control the process.
  896.  
  897. Roughness: Increase to generate more random seed points, giving more hills
  898. and depressions. A value of 0 plots just the initial outer 4 points (1
  899. square), 1 plots 4 squares, 2 plots 16 squares and so on.
  900.  
  901. Height: Specifies the initial maximum displacement as a power of 2. Thus 8
  902. (the default) means 256. Increase this value to give steeper gradients.
  903.  
  904. Seed: The initial random value use to generate the landscape. A new seed is
  905. chosen every time unless Random is set off.
  906.  
  907. Sea Level: An height less than the sea level will be plotted in blue. This
  908. is useful when creating the source images for a Riemann globe.
  909.  
  910. Sea Colour: The physical colour number used for the sea. Blues are 128-131
  911. and 136-139, but any colour may be chosen.
  912.  
  913. Notes On Usage
  914. --------------
  915. This algorithm works best in modes with square pixels, ie. modes 21, 13 etc.
  916. Mode 15 will tend to produce more oblong shapes.
  917.  
  918. Try colour cycling for a psychedelic effect. The landscape palettes give
  919. more realistic results - use Palette shifting to get a sea/land balance.
  920.  
  921. To generate a landscape use one of the 3d viewing functions within !Fractal.
  922. The 3d palette should be set to Linear for the best effects, though
  923. experiment. Try a Riemann sphere for a planet effect - this works best when
  924. the sea level is set above 0 or when using a landscape palette.
  925.  
  926. Midpoint does not multi-task since it is pretty fast.
  927.  
  928. --------------------------------------------------------------------------
  929.  
  930. Newton
  931. ------
  932. This function calculates the cube root of -1 ie. z*z*z-1=0, using the
  933. Newton-Raphson method. There are three possible roots which are: z=1,
  934. z=-0.5+0.8666i, z=-0.5-0.866i. Floating point arithmetic is required so
  935. don't expect it to zip along. Initially 32 bit accuracy is used which is
  936. reasonably fast, then it switches to 64 bit. The menu options are:
  937.  
  938. Plot Root: in this mode, the colour is chosen depending on which root we are
  939. converging to. This is the quickest option, but not very spectacular.
  940.  
  941. Plot Iters: in this mode the colour is set from the number of iterations
  942. required to reach the root. This produces Mandelbrot type displays of
  943. infinite complexity, but it can take a lot of time.
  944.  
  945. There are 2 data variables:
  946.  
  947. Max Iter : iteration limit, mainly of use when using Plot Iters and zooming
  948. in.
  949.  
  950. e : The accuracy check value. The iteration is stopped when a root is found
  951. that solves the equation to within the 'e' accuracy value. Higher values of
  952. 'e' force greater accuracy and more iterations to be used, useful when
  953. zooming in.
  954.  
  955. A 3d version can be drawn directly by turning on the 3d X/Y Plot option.
  956. See the 3d section of !MainHelp for details.
  957.  
  958. --------------------------------------------------------------------------
  959. Pickover - A Strange Attractor developed by Clifford Pickover
  960. --------
  961. This is a 3 dimensional shape controlled by 4 variables. To get a feeling of
  962. the shape you really need to try the 3d viewing options of !Fractal - use
  963. the Rotate & Elevate icons to set your viewing position or better still use
  964. the cursor keys whilst plotting. The plot is infinite and is made with
  965. points rather than lines to avoid too much clutter.
  966.  
  967. The menu options are:
  968.  
  969. Random a/b/c/d: Click to set/unset random selection of the variable when a
  970. plot is started. For each variable there is an associated maximum, which can
  971. be changed from the data panel. New variables are not chosen when zooming.
  972. Once you have found an interesting shape, turn off random variables, and use
  973. the 3d options to explore the shape from different view points. The default
  974. variables were obtained in this way.
  975.  
  976. Random colour: when set a random colour is chosen after every 100 plots.
  977.  
  978. Step Colour: the colour value is increased after every 100 plots.
  979.  
  980. If neither Random or Step colour is set, then the plot is made in white
  981. using exclusive or'ing to trace the current position.
  982.  
  983. You can change the viewpoint whilst plotting by pressing the cursor keys,
  984. and then pressing the space bar to restart. See the 3d section in the
  985. !MainHelp file for more details.
  986.  
  987. Algorithm
  988. ---------
  989.     x=1; y=1; z=1;
  990.     do
  991.       xnew = sin(a*y) - z*cos(b*x)
  992.       ynew = z*sin(c*x) - cos(d*y)
  993.       znew = sin(x)
  994.       plot px,pz                    where px/pz are 3d transform of x/y/z
  995.     forever
  996.  
  997. --------------------------------------------------------------------------
  998. Plasma
  999. ------
  1000. This function has been ported from Fractint. It is a variant on the midpoint
  1001. displacement technique - ie. set the colour of each corner randomly, then
  1002. set each corner of each interior rectangle to a value based on the
  1003. surrounding corners plus a random variant (the graininess value, the amount
  1004. of which you can change). The display looks wonderful when cycled but this
  1005. needs a full 256 colour programmable palette. You can improve the display
  1006. significantly by using !EditPal to design a suitable palette.
  1007.  
  1008. Alternatively try the Landscape palette and one of the 3d transforms. Due to
  1009. the recursive nature of the function it stops if you press Adjust (no
  1010. background plotting).
  1011.  
  1012. --------------------------------------------------------------------------
  1013. Popcorn
  1014. -------
  1015. An algorithm developed by Clifford Pickover featured in Scientific American
  1016. July 1989, then in Fractint (where the name Popcorn was given), and
  1017. contributed here by Joyce Haslam. There are 9 different equations used with
  1018. an option to plot the pattern in a wave like form or a pixel by pixel form
  1019. (Julia).
  1020.  
  1021. The equation is selected from the Popcorn->Types menu. Click on
  1022. Popcorn->Julia to activate the pixel mode plot. The Julia is slow due to the
  1023. repeated use of SIN and TAN, so use small values for limit and threshold to
  1024. speed things up.
  1025.  
  1026. Popcorn in non-Julia mode plots points, the colours of which are set from
  1027. the main Plot Options dialogue box in the Effects menu. For best resuls
  1028. choose Random but other interesting effects can be used. In Julia mode the
  1029. colour is set from the number of iterations.
  1030.  
  1031. The data items after the standard x/y width/height are:
  1032.  
  1033. Limit: for Julia the iteration limit, otherwise the iteration limit sets the
  1034. length of each arm plotted.
  1035.  
  1036. Step Rate: controls the effect each iteration has on previous values. Higher
  1037. values produce more exaggerated plots.
  1038.  
  1039. Detail: for the non-Julia plots - 0 gives maximum detail, higher values
  1040. give rougher images which allows quicker examination.
  1041.  
  1042. Threshold: for Julia, the escape value. Higher values take longer to
  1043. calculate but produce more detail.
  1044.  
  1045. n: The multiplier in the SIN and TAN equations. Try different values to see
  1046. the effect.
  1047.  
  1048. A 3d version of the Julia image can be drawn directly by turning on the
  1049. 3d X/Y Plot option. See the 3d section of !MainHelp for details.
  1050.  
  1051. Algorithms
  1052. ----------
  1053. The nine equations are as shown in the Popcorn->Types menu. They are
  1054. implemented in code as shown in the 2 examples below:
  1055.  
  1056. Julia: for each pixel set the x and y value then :
  1057.   repeat
  1058.     sqsum=x*x+y*y
  1059.     if sqsum < threshold
  1060.        xx=x-dt*sin(y+tan(n*y))           where dt=step rate
  1061.        y=y-dt*sin(x+tan(n*x))
  1062.        x=xx
  1063.        iter=iter+1
  1064.   until sqsum>=threshold or iter=limit
  1065.   colour=iter
  1066.  
  1067. non-Julia: for each nth x/y pixel where the value of n is increased with the
  1068. value of "detail".
  1069.  
  1070.   repeat
  1071.      xx=x-dt*sin(y+tan(n*y))             where dt=step rate
  1072.      y=y-dt*sin(x+tan(n*x))
  1073.      x=xx
  1074.      iter=iter+1
  1075.      plot x*scalar,y*scalar
  1076.   until iter=limit
  1077.  
  1078. --------------------------------------------------------------------------
  1079. Quaternion : Invented by William Hamilton, 1843
  1080. ----------
  1081. A Quaternion is a 4d equivalent of a complex number, written as:
  1082.      Q = a+bi+cj+dk
  1083. where i, j and k are imaginary numbers. They are used here in a similar way
  1084. to Julia sets with Q -> Q²+q where q is a quaternion constant, made up of
  1085. q0, q1, q2 and q3 in this routine. The routine maps out a 2-dimensional
  1086. slice using x=a and y=c, with the values of b and d being set to choose
  1087. which slice of the 4d plane we are drawing.
  1088.  
  1089. The initial values chosen for q0 and q2 are the same as those for the Julia
  1090. Set, and you will note the image is superficially very similar. Changing q1,
  1091. q3, b or d however allows different planes to be examined, giving a great
  1092. area to investigate.
  1093.  
  1094. As with the Julia set, the best way to choose values for q0 and q2 is from
  1095. the Mandelbrot set - use the Quaternion menu option to pick a point from
  1096. near the boundary.
  1097.  
  1098. The menu options operate in the same way as for the Julia set.
  1099.  
  1100. Algorithm
  1101. ---------
  1102. A 32 bit and floating point version are provided, but both will be slower
  1103. than Julia's due to the extra multiplications.
  1104.  
  1105. For each pixel we calculate the a (x) & c (y) value and then iterate. The
  1106. colour is the iteration number unless Q²>4.0, when we set the colour to 0
  1107. (or as set by the Interior menu option).
  1108.  
  1109.    iter=0;
  1110.    repeat
  1111.      iter + 1
  1112.      if (a²+b²+c²+d²>4) then escape
  1113.      new_a=a²-b²-c²-d²+q0
  1114.      b=2*a*b+q1
  1115.      c=2*a*c+q2
  1116.      d=2*a*d+q3
  1117.      a=new_a
  1118.    until iter>=max_iter
  1119.  
  1120. Notes: It is possible to use other functions such as Q->Q³+q as done for
  1121. Mandelbrot's. Also it is possible to produce a 3d mapping, though a lot of
  1122. the swirling detail apparently is lost. Iterating the function Mandelbrot
  1123. style gives a variation on the Mandelbrot shape.
  1124.  
  1125. --------------------------------------------------------------------------
  1126. Rossler : The Otto Rossler Strange Attractor.
  1127. -------
  1128. This strange attractor is similar to the Lorenz with a very distinctive
  1129. shape. The shape is three dimensional which looks like a treble cleff from
  1130. some angles. You can use !Fractal's Rotation and Elevation icons to control
  1131. the view position to explore the shape. There are three variables which may
  1132. be set or randomly chosen, and there are three colour schemes.
  1133.  
  1134. The plot is infinite. You can control the speed by setting the Step Rate
  1135. factor - smaller values will slow the plot so you can trace its shape.
  1136. Notice that the plot revolves around a point then leaps off in a strange
  1137. loop. Try altering the default values of a/b/c by small amounts and see the
  1138. effect this has on the shape and when the jump occurs. Alternatively try
  1139. using one or more random variables to see what shapes you can arrive at.
  1140.  
  1141. The menu options are:
  1142.  
  1143. Random a/b/c: Click to set/unset random selection of the variable when a
  1144. plot is started. For each variable there is an associated maximum, which can
  1145. be changed from the data panel. New variables are not chosen when zooming.
  1146. Once you have found an interesting shape, turn off random variables, and use
  1147. the 3d options to explore the shape from different view points.
  1148.  
  1149. Random colour: when set a random colour is chosen after every 100 plots.
  1150.  
  1151. Step Colour: the colour value is increased after every 100 plots.
  1152.  
  1153. If neither Random or Step colour is set, then the plot is made in white
  1154. using exclusive or'ing to trace the current position.
  1155.  
  1156. You can change the viewpoint whilst plotting by pressing the cursor keys,
  1157. and then pressing the space bar to restart. See the 3d section in the
  1158. !MainHelp file.
  1159.  
  1160. Algorithm
  1161. ---------
  1162.     x=1; y=1; z=1;
  1163.     do
  1164.        new x=x-y*dt-z*dt            dt=step rate
  1165.        new y=y+x*dt+a*y*dt
  1166.        new z=z+b*dt+x*z*dt-c*z*dt
  1167.        draw px,pz                   px/pz are 3d transform of x/y/z
  1168.     forever
  1169.  
  1170. --------------------------------------------------------------------------
  1171. Unity
  1172. =====
  1173. This transformation was developed by Mark Peterson of Fractint and is a
  1174. simple "Newton" style algorithm, which is:
  1175.  
  1176.    One=x*x+y*y;  y=(2-One)*x;  x=(2-One)*y;
  1177.  
  1178. which is iterated for each screen pixel until 1-One=0 within the accuracy of
  1179. plotting. The colour is the number of iterations (+32 to avoid dark
  1180. colours). The plot looks very similar to a Henon map, with thin lines that
  1181. get thinner when you zoom in.
  1182.  
  1183. Unity uses integer arithmetic and thus soon hits a zoom limit.
  1184.  
  1185. --------------------------------------------------------------------------
  1186.  
  1187. 3d Transforms
  1188. =============
  1189. These take a fractal image and transform it. The best images are those of
  1190. Mandelbrots using a standard or inverted palette (but feel free to
  1191. experiment). Except for Riemann, they do not multitask since they are quite
  1192. quick. They offer varying degrees of control.
  1193.  
  1194. There is a common menu option which allows you to re-display the source
  1195. image, and then store it again as the 3d source. This allows you to do three
  1196. things:
  1197.  
  1198. a) change the colours of the original image, by using the Effects->Palette
  1199. menu. For Render and 3d views this will change the displayed height.
  1200.  
  1201. b) Rotate the source image via the tools rotate icon.
  1202.  
  1203. c) Use a 3d image as the source of another (or same) 3d transform.
  1204.  
  1205. 3d View and Riemann provide rotation directly - for the others use the
  1206. Rotate rotate tool icon.
  1207.  
  1208. Return to function: This menu option takes you directly back to the original
  1209. function, displaying the source image to allow zooming to re-commence.
  1210.  
  1211. Height Mapping
  1212. --------------
  1213. The 3d_Plane, 3d_View and Render functions use the pixel colour to determine
  1214. the height. Use the Effects->3d Details panel to control this mapping
  1215. process, described in the !MainHelp file. When these functions are selected
  1216. the min and max pixel colours are automatically calculated. Override these
  1217. values to smooth out peaks or clip the image. To reset the values use the
  1218. Initial button on the Image->Data panel.
  1219.  
  1220. 3d Plane
  1221. --------
  1222. Presents an oblique view of an image, scaled to fit onto the screen. The
  1223. height is based on the source colour (0=low, 255=high). The data variables
  1224. are:
  1225.  
  1226. x Scalar: a value of 1 plots the x axis full size. Use smaller values to
  1227. accomodate the shift incurred by the viewing angle.
  1228.  
  1229. y Scalar: a value of 1 plots the y axis full size, but 0.6 provides a more
  1230. realistic image.
  1231.  
  1232. The rotation angle is used as the angle of the y axis, with 90° being the
  1233. far right and -90° the far left. Larger angles will tend to lower the
  1234. viewpoint and see more to the left or right. You can use the Rotation tool
  1235. icon  but note that the viewpoint angle is only an indication of the
  1236. apparent direction.
  1237.  
  1238. 3d View
  1239. -------
  1240. This offers a more realistic 3d image than 3d Plane, and provides two
  1241. viewing options - either full rotation or a front end view with perspective
  1242. control. The data parameters are:
  1243.  
  1244. Distance: when Rotation=0 this parameter controls the vanishing point. A
  1245. value of 1 gives the maximum distortion, whilst larger values give more
  1246. subtle effects.
  1247.  
  1248. Sea Level: colours below sea level are plotted up to the sea level height
  1249. but in their original colour, thus smoothing out low values. Useful with the
  1250. Landscape palette (set Sea Level=119).
  1251.  
  1252. From the 3D_View menu you can set Smooth: when off contour lines are
  1253. accentuated, which works well with Mandelbrot images. When on contour lines
  1254. run into each other, which works best with landscapes such as Midpoint and
  1255. Fault functions.
  1256.  
  1257. Render
  1258. ------
  1259. Draws a 3d representation as seen full on, using the colour as the height. A
  1260. light source is assumed from the bottom left corner and is used to add a
  1261. shadow effect. The shadow effect works best with the default palette. 
  1262.  
  1263. From Render's menu you can select the elevation viewpoint, or you can use
  1264. the Elevation tool icon to control this. Note that only 4 angles are
  1265. available.
  1266.  
  1267. Riemann
  1268. -------
  1269. Takes the image and maps it onto a sphere, using a Riemann transformation.
  1270. Imagine a sphere placed on top of the image. Draw a line from each point on
  1271. the image to the north pole. A point is plotted where this line intersects
  1272. the sphere. Thus the centre of the image is mapped onto the south pole
  1273. whilst a point can can only be mapped onto the north pole if it is at
  1274. infinity. See the article in Fractal Report 16 by Roger Castle-Smith for a
  1275. full explanation.
  1276.  
  1277. There are two ways to use this function. For the best results turn on
  1278. Riemann Plot in the 3d Effects panel which will directly generate a Riemann
  1279. sphere for X/Y functions (Lyapunov, Julia, Mandelbrot, Newton, Unity etc).
  1280. This method allows all the values to be calculated out to infinity at the
  1281. north pole.
  1282.  
  1283. The alternative method is to draw the image and then select Riemann. The
  1284. image will be transformed onto the Riemann sphere, but obviously values near
  1285. the north pole can not be calculated. To overcome this limitation it is
  1286. possible to scale up the image size, though this will lead to some
  1287. distortion of the image.
  1288.  
  1289. The data values are :
  1290.  
  1291. Image Scale: the source image size in relation to the sphere size. Larger
  1292. values will mean that the source image is stretched up towards the north
  1293. pole. Not used when doing a direct Riemann plot.
  1294.  
  1295. Globe Scale: the globe size as a fraction of the total image size (0 - 1.0).
  1296. Thus 0.5 produces a globe half the total image size. Smaller values help
  1297. reduce the distortion introduced by the mapping process when using an image
  1298. as the source.
  1299.  
  1300. Fill Colour: The colour used to fill in black pixels. Use !Editpal to choose
  1301. a colour number for the palette you have selected.
  1302.  
  1303. ----------------------------------------------------------------
  1304.