  ________________________________________________________________________
 /                                                                        \
|                !Interfere v1.0: Interference Patterns                    |
|                              25 May 1991                                 |
|                            by Mike Curnow                                |
 \________________________________________________________________________/ 

Introduction
============
!Interfere exploits a simple algorithm developed by John E Conett to plot
interference patterns and then animate them by gradually stepping through
the circles plotted. The animation is quite mesmerising whilst the patterns
it generates would are suitable for thousands of exclusive fabric designs!
This is one program your girlfriend/wife will want to use.

The patterns are calculated in a similar way to many Fractals, but the
result here is not fractal, being of finite intricacy and very repetitive.
The animation plots at 7 times a second (25 on an ARM-3) which is pretty
impressive for a near full screen graphic.

Basic Usage
===========
Double click on the !Interfere icon to load it onto the icon bar. Then click
on the icon to display the initial pattern. The right hand side of the
display provides a menu explained below. Note that operation here is in
non-desktop mode and the mouse buttons have a different effect than normal.

Clicking on Start begins the animation, whilst Stop pauses the display.
Click on Smaller or Larger to change the size of the plotted circles. It is
also possible to switch from 16 colour mode (the default) to 256 colour
mode. The Save button allows the current image to be saved in standard AFG1
sprite format. Saved images can be reloaded by dropping onto the !Interfere
icon, whilst the 16 colour palette can be altered from the main menu.

To find the most pleasing combinations it is a matter of patiently hunting
around by changing the Size value. I find that prime numbers often produce
good displays. You will notice that a small change in Size can radically
alter the interference pattern, some of which are very large and take some
time to roll through. For instance try setting Size=229.
 
Full Operation Information
==========================
!Interfere requires a considerable amount of storage : 128k for itself and a
double sized Mode 9 or Mode 13 screen. Most of the operation is in
non-desktop mode mainly for performance purposes.

The main window can be opened either by clicking on the desktop icon or by
dropping a previously saved Interfere sprite on to the icon.

Desktop Icon And Menu
---------------------
Clicking Select over the desktop icon brings up the main display window.

Clicking menu over the desktop icon opens a menu which shows the following
options:

Info: Standard program credits and version number.

Palette: Leads to a submenu showing the palettes that can be selected. The
current palette will be ticked unless a user palette has been loaded.
Palettes only have effect in 16 colour mode (this is a current Archimedes
limitation). The supplied palettes are the desktop default, Red, Green, Blue
and Grey. The single colour palettes can help reveal finer interference
patterns.

You can supply your own palette by dragging a palette (created within
!Paint) onto the desktop icon. It's name is remembered and the file loaded
when the main window is opened.

Quit: Terminates the program.

The Main Menu Options
---------------------
Any item on the menu can be selected by any of the mouse buttons and most
can be selected at any time - exceptions are noted in the descriptions. When
selecting the Start, Step In, Step Out, Smaller and Larger menu items, the
mouse keys have the following effect:

  Select: Increment/Decrement item by 1
    Menu: Increment/Decrement item by 2
  Adjust: Increment/Decrement item by 4

Thus the animation can be begun by clicking Select over Start, then sped up
by clicking Menu or Adjust at anytime.

Offset: Allows the display offset to be manually entered by clicking in the
region of the Offset button and value. Increasing the offset gives the
appearance of zooming in. Negative values can be used. Press Return to enter
the value.

Size: Allows the size of the prime circle to be manually set by clicking in
the region of the Size button or value. Higher numbers will result in
smaller base circles, but more intricate interference patterns then start to
appear.

Stop: Stops the animation if in progress.

Start: Starts the animation by incrementing the Offset value by 1,2 or 4
according to the mouse button pressed. Using larger increments gives the
impression of faster animation, at the price of a more jerky display.

Step In: Increases the offset value by 1, 2 or 4 when in Stop mode only.
Holding down the mouse button will repetitively apply the increment.

Step Out: Decreases the offset value by 1, 2 or 4 when in Stop mode only.
Holding down the mouse button will repetitively apply the decrement.

Reverse: When in animation mode, switches between incrementing and
decrementing the Offset value.

Smaller: Increases the Size value by 1, 2 or 4, giving the effect of zooming
out from the prime circle, making the circles appear smaller. This tends to
produce increasingly complex interference patterns.

Larger: Decreases the Size value by 1, 2 or 4, giving the effect of zooming
into the prime circle.

16 Clr: Switches to the (default) 16 colour display (Mode 9). This mode
generally produces the most pleasing colour combinations and allows
modification of the palette if required.

256 Clr: Switches to a 256 colour display (Mode 13). In this mode larger
Size values will be required to get the similar sort of interference
patterns. There is also a slight reduction in animation speed. This mode is
provided just in case you thought 256 colours are better - in this case I
think not!

Save: Allows the interference pattern to be saved as a sprite file. You are
prompted for the filename - this will need to be fully qualified if you do
not want it to end up in the current directory ie. enter something like:
    $.directory.filename
The sprite is saved in AFG1 format, that is with the Offset and Size values
stored within it. Saved files may be reloaded by simply dragging them onto the
!Interfere icon. 256 colour files may be dropped into !AFGSprite to produce
yet more amazing displays. Note that the current palette is saved with the
sprite but is ignored on re-loading.

Desktop: Returns to the desktop. You can return to the display at any time
by clicking select on the desktop icon.

Known Limitations
-----------------
Re-loaded images do not set the palette to the saved state, but it is pretty
easy to bring back into line using the original palette file. 

Programming Note
----------------
AFGSprite is written in a mixture of Basic and Assembler. Most of the Wimp
processing is contained within the BASIC library Wimplib.

The routine was first published in Scientific American no.255 December 1986.
The version used within !Interfere has been highly optimised in Assembler to
get the necessary speed. The routine is however an example of incredible
simplicity. I list below the version used within !Interfere.

  FOR j = 0 TO Yscreen-1              ie. screen resolution
    FOR i = 0 TO Xcreen-1
      x = Offset + Size*i/Xscreen
      y = Offset + Size*i/Yscreen
      z = x*x + y*y
      clr = INT(z) MOD number_of_colours
      Setpoint(i,j,clr)
    NEXT
  NEXT

The Assembler version gets some of its speed by using a fixed resolution of
256*256 which allows for a fast divide (so don't try and bodge it to use a
full sized screen). It calculates all the colours for each screen word (ie.
8 values in 16 colour mode) before updating the screen directly. This
minimises memory access. The routine gave me my first opportunity to try out
the MLA (multiply and add) instruction.

Evenso the animation is still jerky - 7 frames a second is slightly too slow
for a smooth display, even though it uses 2 screen banks. With an ARM-3 it
is almost too fast!

The program could be modified to use Mode 1 with 4 colours but this would
not speed up the animation since it is the number of calculations that is
the controlling factor. Changing the resolution to 128*128 should provide an
increase to 25 frames a second. Since I have an ARM-3 I am quite happy with
the speed - I leave it to you to do the small adjustment.

For a description of AFG sprites see the help file with !AFGSprite.


History
=======
v1.00  25/05/91  Initial public version and desktop conversion.


Final Boring Copywright Notice
==============================
The copywright of this material belongs to Mike Curnow except for the !Help
application which belongs to J Rling. This software may be passed on to
others as long as NO CHARGES ARE LEVIED except to cover costs.


Archimedes Fractal Group (AFG)
==============================
This software is part of the Archimedes Fractal Group collection. If you
have obtained this software outside of the AFG and would like to find out
more about Fractals on the Archimedes, contact me (the AFG administrator) at
the address below. Send a SAE and a disk to get a free AFG demo disk.

Mike Curnow,
30 Bowen Drive,
West Dulwich,
London
SE21 8PN

                       
                   <<<< MAY THE CHAOS BE WITH YOU! >>>>
