home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d1xx / d188 / fracgen.lha / FracGen / ReadMe < prev    next >
Text File  |  1989-02-26  |  12KB  |  306 lines

  1.  
  2.                      FRACTAL GENERATOR 1.2
  3.                   Copyright (c)1988 Doug Houck
  4.  
  5.  
  6. DISTRIBUTION NOTICE
  7.  
  8.   This Fractal Generator may be freely distributed, so long as this
  9. notice is retained, and no profit is gained from the distribution of
  10. this program.  Please be sure to copy the accompanying subdirectories,
  11. with a "copy all" or by using Workbench.
  12.  
  13. SOURCE CODE
  14.  
  15.   Due to the fact that this program is laced with code that is part
  16. of commercial products (Doug's Math Aquarium, Doug's Color Commander,
  17. both available from Seven Seas Software), the remaining code would be
  18. of little value to you except as examples. So it has been omitted.  
  19.  
  20. BUT WHAT DOES IT DO?
  21.  
  22.   This program grows fractal pictures from seeds you create.  It is 
  23. meant to be a tool for exploring the world of fractals.  It can be
  24. enjoyed on three levels: (1) loading and displaying fractals stored
  25. on disk, (2) modifying existing fractals, and (3) creating your own 
  26. fractals.
  27.  
  28.   The main idea of this program is very simple.  Take a shape composed
  29. of several line segments, and replace each line segment with a small
  30. copy of the entire shape.  Continue doing this until you reach the
  31. resolution limit of your screen.  For example: (Koch Snowflake)
  32.  
  33.               /\
  34. Seed             /  \
  35.         ____/    \____
  36.  
  37.             __/\__
  38. 1st Generation        \    /
  39.         _/\_/    \_/\_
  40.  
  41.  
  42.   What you have is a self-similar fractal.
  43.  
  44.  
  45. GETTING STARTED
  46.  
  47.     There are a number of fractals stored on disk.  To get at them,
  48. just hit Load, and double-click on a filename.  It will plot automatically.
  49. Hit the Menu button to return to the editing screen.
  50.  
  51.     If you wish to edit the shape of a fractal seed, select one of
  52. "Add", "Delete" or "Move" from the Edit menu, and manipulate the shape
  53. with the mouse.  TIP: Keep the fractal seed simple.
  54.  
  55.     To draw a new fractal, select Draw in the Fractal menu.
  56.  
  57.     For more control of the fractal, select Parameters in the Fractal
  58. menu.  See below for more info on Parameters.
  59.  
  60. =================  The Menu options are explained below. ==================
  61.  
  62.    PROJECT
  63.       Undo       Remove changes since previous Draw.
  64.       New        Initialize to simplest fractal - a straight line
  65.       Load       Load fractal seed and colors from disk.  
  66.       Save       Save fractal seed to disk.
  67.       Save Pic     Save picture in IFF file
  68.       Quit       Quits program.
  69.  
  70.    EDIT
  71.       Add        Adds a point in the nearest line segment.
  72.       Move       Moves the nearest point.
  73.       Delete     Deletes nearest point.
  74.  
  75.    FRACTAL
  76.       Draw       Draws fractal using current parameters and options.
  77.       Parameters Displays current parameters, allows editing.
  78.            See below on Parameters
  79.       Detail     Length of the shortest allowed line segment.
  80.                  Make larger (5?) for faster drawing.
  81.       Depth      Maximum amount of times to replace line segment
  82.                  with copy.  Max 500, less if program stack < 25000.
  83.  
  84. MORE COMMANDS
  85.  
  86.     <F1>        Flip screens
  87.     <F2>        Detail
  88.     <F3>        Depth
  89.     Arrow keys    Push fractal seed around screen
  90.     <N>        New Fractal
  91.     <ESC>        Stop plotting
  92.     Menu Button    Flip screens
  93.     <F>        Draw Fractal
  94.  
  95.     For ultimate power, you may edit the files in which it saves the 
  96.     seed formulas with any plain ascii editor.  
  97.  
  98. FEEDBACK
  99.  
  100.     The screen title bar gives feedback information as follows:
  101.  
  102.     Degrees1  Length1  Degrees2  Length2  PixelX PixelY
  103.             \/                 \/              \/
  104.        Line to Left       Line to Right   Absolute Pixel Coordinates
  105.  
  106.     Degrees is the change in heading relative to the line to the left.
  107.         (previous line)
  108.     Length is the length of the line in pixels.
  109.     Pixel is the absolute screen location, where y increases from top
  110.         to bottom.
  111.  
  112. PARAMETERS
  113.  
  114.     RECURSION LEVELS means the following parameters are applied on
  115.     a level by level (generation) basis, where the first character
  116.     applies to the first generation, the second character applies
  117.     to the second generation...  The parameters for the level are
  118.     used BEFORE the line segment parameters.
  119.  
  120.     LINE SEGMENTS means the following parameters are applied to
  121.     the individual line segments of the seed shape.  The first
  122.     character applies to the first line segment (starting from the
  123.     left), the second character applies to the second line segment...
  124.  
  125.     REPEATING is applied to each string to make it long enough.
  126.     For example:
  127.         f      = 'ffffffffffffffffffff...'
  128.         fr     = 'frfrfrfrfrfrfrfrfrfr...'
  129.         vii    = 'viiviiviiviiviiviivi...'
  130.     If invalid characters are present, it defaults to the first
  131.     character in the 'f/r' (or whatever) specification.    
  132.  
  133.     DIRECTION can be forward (f) or reverse (r).  Reversing a shape
  134.     means to swap end for end.
  135.     It converts __/\ to /\__
  136.  
  137.     FLIP can be either normal (n) or flipped (f).  Flip means to
  138.     flip the shape along the axis formed by the endpoints of the shape.
  139.     It converts __/\ to __
  140.                           \/
  141.  
  142.     Flip and reverse can be combined, ergo
  143.     both flip and reverse convert __/\ to   __
  144.                                           \/
  145.  
  146.     VISIBLE can be visible (v), invisible (i), or mule (m). 
  147.     It is applied to each segment of the shape numbered from left
  148.     to right (as the shape was created).
  149.     -    Visible means that the line segment will propogate to the
  150.     next level, or show if it is the last one.
  151.     -    Invisible means that the line segment will not show, or
  152.     propogate.
  153.     -    Mule means that this line segment will show, but not
  154.     fractalize.  (Mules are sterile.)
  155.     For instance, 'viv' converts __/\ to __ \
  156.  
  157.     COLOR controls how often the color register is advanced.
  158.     For example, '001' would not increment the color on the first
  159.     2 levels of recursion, but would advance by 1 on the third level.
  160.  
  161.     EXPERIMENT with each of these controls with depth set to 2 or 3,
  162.     a simple shape, varying one parameter at a time.
  163.  
  164. ============================================================================
  165.  
  166.   'Fractal Will Expand' requester - what it means.
  167.  
  168. Imagine a line drawn from one endpoint of your shape to the other.  If any
  169. one of the lines in your shape is bigger than this imaginary line,
  170. the fractal will expand.  The easiest way to fix this is to move your
  171. shape endpoints farther apart, thereby making the component line segments
  172. smaller in comparison.
  173.  
  174.   If you decide to Try It, one of three things may happen.
  175.  
  176.     1.  The line drawing routine tries to draw into a far corner of the
  177.         Amiga's memory.  Corners being what they are, there may be a moron
  178.         program there which is confounded by strange new opcodes.  (Reader
  179.         Problem:  Design a program (a la Core Wars) which can withstand the
  180.         onslaught of a line drawer gone wild.)  The Amiga clips lines that
  181.     wander off the edge of the screen, IF they don't wander too far.
  182.  
  183.     2.  You wisely chose a small Depth, and made sure the line segments
  184.         are only marginally larger than the shape endpoint-to-endpoint
  185.         length.  Some wild lines appear on your screen, but nothing blows
  186.         up.
  187.  
  188.     3.  Time is consumed at the following rate where:
  189.  
  190.         lines_per_second = 650   on the Amiga 1000
  191.         
  192.         Time = ((number_of_line_segments)^Depth)/lines_per_second
  193.  
  194.     For example, the shape /\, which is two sides of an 
  195.     equilateral triangle, if fractalized to a depth of 70,
  196.     would take roughly
  197.  
  198.         (2^70)/650  seconds, or 58 billion years!
  199.  
  200.     Not to knock the Amiga, but that's probably longer than the MTBF.
  201.  
  202. FOR HACKOIDS
  203.  
  204.     You may also enter the seed shapes directly - here's how.
  205.  
  206.     Select Load, and enter the Drawer "Con:0/0/200/50/input".  It will
  207.     give you some "Drawer not Found"s, but hit OK anyhow.  You have
  208.     just opened the console file on the workbench screen.  Pull
  209.     down the FracGen screen part way, and the plotting screen too to
  210.     expose the "input" window on Workbench.  
  211.  
  212.     Now type commands in the "input" window just like they would appear
  213.     in a formula file.  The two most useful commands are:
  214.  
  215.         Point x y        ; Line to this point.
  216.  
  217.         Angle degrees length    ; Turn in this direction, and
  218.                     ; draw a line this long.
  219.                     ; This is relative to your current
  220.                     ; heading, a la Turtle Graphics.
  221.  
  222.     I would suggest a sequence like the following for the Koch Snowflake
  223.  
  224.         Point 100 100        ;.     ; define starting point
  225.         Angle 0 75        ; __    ; start pointing thisaway-->
  226.         Angle 60 75        ; __/
  227.         Angle -120 75        ; __/\
  228.         Angle 60 75        ; __/\__
  229.  
  230.     Press <CTRL><\> (control and backslash) to terminate input.
  231.     Center the seed with the cursor keys.
  232.  
  233. CHANGING COLORS
  234.     There is a drawer named "Palettes", which contains just the color
  235. information of a fractal seed.  To try different colors in your picture,
  236. simply load the appropriate color palette, and hit <F1> to flip screens
  237. and see the effect.  To create your own palette files, save a fractal
  238. to that directory, then delete all but the color information with an
  239. editor. (Crude, but effective.)  Of course, the best way to change
  240. the colors is with Doug's Color Commander, by Yours Truly, published by
  241. Seven Seas Software.  (and ought to be available by the time you read this.)  
  242.  
  243. SAVING FRACTALS
  244.  
  245.     Feel free to add your own beautiful fractals to this collection.
  246. Before you save the fractal, select the Parameters window, and enter your
  247. name and some notes about your particular fractal.
  248.  
  249. IMPLEMENTATION
  250.  
  251.    This was coded in Lattice C, and hacked into Manx C, except for a
  252. custom fixed point multiply in Assembly.  I use the Motorola Fast
  253. Floating Point library for all the shape manipulation, then do all
  254. the fractal drawing with fixed point arithmetic, which cooks on 
  255. multiplication, and really flies on addition and conversion to integers.
  256.  
  257.    Actually, the hardest part was the routine to find the nearest line
  258. segment in Add point.  It requires a rotation of axes before the distance
  259. can be determined.  If you have a large number of points (>10) you will
  260. notice a slight delay as it cranks through all the calculations.
  261.  
  262.   FracGen is sensitive to the default screen size, so it should work OK
  263. on PAL screens, and MoreRows systems.  
  264.  
  265.   There are limitations imposed because of the granular resolution of
  266. computer screens.  For example, a diagonal line may not be exactly 50 
  267. units long, as it snaps to the nearest pixel coordinates.  I could
  268. have implemented virtual coordinates for the scientific community, but
  269. that would have complicated onscreen editing, which is the key to being
  270. user friendly.  (If there is enough interest (read 'money') I may do a
  271. virtual model.)  A possible editing scenario is to select the line
  272. segment/point with the mouse, bringing up a bank of slider gadgets, which
  273. lets the user individually change the length/angle/color/direction/etc.
  274. Got a better idea?  Let me know.
  275.  
  276. REFERENCES
  277.    As usual, I refer you to Benoit B. Mandelbrot's book, The Fractal
  278.    Geometry of Nature, W. H. Freeman and Company, 1977.  Look especially
  279.    around page 43(?), and at the Koch Snowflake, which inspired this
  280.    program.  Also, there are numerous shapes spread throughout the book.
  281.  
  282.    August 1987 Byte, Creating Fractals (p. 125) by William A. McWorter and
  283.    Jane Morrill Tazelaar.  The program described has different capabilities
  284.    than FracGen, (I can't do a Hilbert curve), and the formulas are
  285.    different, but it should spark your imagination.  It is clear that 
  286.    they were pioneering.
  287.  
  288. KUDOS
  289.  
  290.   If you derive excessive pleasure from this program, you may send
  291. your appreciation and spare change to:
  292.  
  293.      Doug Houck
  294.      922 West Uncas Road
  295.      Port Townsend, WA  98368
  296.      USA
  297.  
  298.   If this program blows your power supply, crashes your hard disk, or
  299. fails to perform to your expectations, you may send your bills and 
  300. criticisms to:
  301.  
  302.      Bit Bucket
  303.      Track 81
  304.      Daisy Plains, IO 80286
  305.      Nomodemsland
  306.