home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 1: Amiga
/
FrozenFish-Apr94.iso
/
bbs
/
alib
/
d5xx
/
d588
/
mandelsquare.lha
/
MandelSquare
/
MandelSquare.doc
< prev
next >
Wrap
Text File
|
1992-01-04
|
20KB
|
354 lines
========================== MandelSquare 1.3 ==========================
======================================================================
Yet another Mandelbrot set exploration program written by Olaf `Olsen'
Barthel. © Copyright 1991 by Olaf `Olsen' Barthel, Freeware, all
rights reserved.
No guarantee of any kind is made that the program described in this
document is 100% reliable. You use this material on your own risk.
========================= A word of warning ==========================
======================================================================
`MandelSquare' is a very `demanding' program which will run only on
Amiga systems equipped with expensive custom hardware (i.e. '881/'882
accelerator boards, 68020/30/40 processors and real fast ram), a plain
A3000(T/UX) will do as well, but not quite as nicely as an A2000 with
a GVP A3001 expansion board or an A3000(T/UX) fitted with an '040
card.
Kickstart 2.x (v37.175 or higher) is required as well, any attempt
to run this program on a plain A500/A2000 will fail.
YOU HAVE BEEN WARNED!
============================= Background =============================
======================================================================
I have been toying with this kind of program for a long time, I even
started writing it on my ol' faithful A500 back in 1990. Since I
don't have a great interest in mathematics (which currently causes
`some' problems while studying computer science at university) I
started this project to learn a bit about complex numbers and to shake
off some of the trouble mentioned before.
The first internal revisions of this program would simply calculate
pictures dot by dot. This technique while accurate and precise takes
quite a lot of time (see Thomas R. Wilcox' `MSE'). There are faster
ways to calculate a picture, such as the recursive routine
`MandelSquare' uses: the screen is divided into four areas; if the
pixels in the four corners are of the same colour, the rectangle is
filled in this colour, if not, the area is divided into four
rectangles and the same procedure is applied again. This technique
relies on the fact that the Mandelbrot set does not contain isolated
points, each outline rests within a different outline, just like a
babooshka puppet is contained in its mother puppet. `MandelSquare'
uses a very simple form of this algorithm which requires that the
rectangles are square, and that's how the child received a name...
`MandelSquare' uses the standard z²+c algorithm to generate
pictures, a numerical coprocessor or an '040 is required since the
calculation is done in a fast hand-coded '881/'882 assembly language
subroutine. While throughout the whole program double precision
values (64 bits) are used for calculation, the '881/'882 assembly
language subroutine uses extended precision (96 bits) to do its job.
While I can and will not claim that `MandelSquare' is the fastest
Mandelbrot set exploration program, I may say that it is the fastest
program in respect to its accuracy and the algorithm employed.
Colours are assigned to pixels based on a linear transition table
which avoids the unpleasant look of broken colour ranges. Transition
tables are created according to the screen resolution (32/16 colours).
Except for the rectangle filling routines `MandelSquare' uses
custom assembly language routines to do the picture rendering. The
program still tries to be very careful not to disturb system imagery
such as the menu bar and the pull down menus.
The screen size depends on the text overscan settings of your
machine. The following text assumes a resolution of 256 × 256 pixels
(low resolution) and 512 × 512 pixels (high resolution).
In late August I played with the idea of adding animation support
to the program, and here it is: select the area you wish to zoom to
and `MandelSquare' will generate a standard Anim-Opt-5 animation file
while it zooms to the indicated spot. The animation file can be
viewed using programs such as `ShowAnim', `DisplayAnim', `PPAnim',
`Animagic', `The Director', `DPaint III/IV' and `MandelSquare' itself,
of course. Many thanks to Gary Bonham and Jim Kent for releasing the
anim file creation/delta compression and replay code to the public
domain.
At startup time `MandelSquare' tries to read a file called
`MandelSquare.Title' which happens to be the standard Mandelbrot set
picture where all explorations will start. If the named file cannot
be found the program will generate the picture it needs, and you are
advised to save it to disk under the name mentioned before.
============================= The menus ==============================
======================================================================
Following is a description of the functions and options associated
with the pull down menus.
Open Picture........... Opens a picture file in IFF-ILBM format
created by `MandelSquare', reads and displays
it. Since coordinates, number of iterations
and screen width are saved with the picture
you may continue exploring from the point
where you saved it.
Save Picture........... Saves the current picture under the last name
a picture file was loaded. If no file name
was loaded yet, you will be prompted to
provide a file name.
Save Picture As........ Saves the current picture under a name you
have to provide.
Priority............... This menu allows you to select the task
priority `MandelSquare' will run under. While
0 is the standard priority the majority of
tasks and processes will execute on your
machine you may want to change this value to
-5 to save processing time other tasks may
wish to allocate or to +5 to make
`MandelSquare' allocate more processing time
than possibly available when running under
priority 0.
Replay Animation....... Will load and replay any animation file
which meets the following conditions:
- Since the replay routines do not open their
own display (as most anim players do) it
will use the `MandelSquare' screen for
display. This means that any animation to
be replayed must be recorded in the same
resolution (width, height, depth) as the
current screen.
- The animation file must be compressed using
delta mode 5.
- There must be enough memory available to
load the animation frames. Any animation
which does not fit into memory will be
truncated.
If successfully loaded the animation will
be played repeatedly. Press any key or mouse
button to abort.
Begin Animation........ After providing a file name to save the
animation file under this will start the
animation routine. The mouse pointer will
change to a crosshair allowing you to select
the area to zoom to. A requester will ask you
to confirm the area size and positionm offer
you reselect it (select `No' to do so) or to
abort the animation (select `Abort'). If
confirmed the animation will start. It can be
aborted at any time by selecting the menu `End
Animation'. After the animation has been
rendered you will again be presented with the
crosshair mouse pointer and the whole
procedure starts again. Should you decide not
to continue the animation just select a dummy
area and click on the `Abort' button of the
confirmation requester.
The confirmation requester will also
display the number of pictures to create in
the animation when zooming to the selected
spot. This value is based on the current
`Scroll Amount' settings (see below).
End Animation.......... Selecting this menu item will stop any
animation creation currently in progress and
close the animation file without including the
current picture.
Set Scroll Amount...... The moves and zooms performed when generating
animations depend largely on a magic value
which can be adjusted when selecting this menu
item. The `scroll amount' controls how many
pixels long a move or zoom may actually be.
Any distance longer than this value will be
truncated and move/zoom will be scaled
approriately. This assures that moves and
zooms will always execute at the same `speed'.
(It took me about a month to discover this
method of operation :-)
Include Frame.......... When zooming into an area `MandelSquare' will
draw a square around the area to zoom to if
this options is in effect. This frame
actually shows you where you are going to in
the Mandelbrot set and may remind you of
Charles Eames' famous `Powers of Ten'
film/slide show.
Include Coordinates.... If this option is in effect the coordinates
and screen size of each picture to be added to
an animation file will be printed into the
lower left corner of the image before it is
saved.
Change Resolution...... `MandelSquare' operates in two different
resolutions: low resolution (256 × 256, 32
colours) and high resolution (512 × 512, 16
colours). Selecting this menu item will
toggle between both resolutions. Note that
you will lose your current picture if you
change the resolution. `MandelSquare' will
immediately start recalculating the previous
picture in the current resolution.
About.................. Shows a small `author' requester.
Quit................... Terminates the program.
Magnify................ This menu item lets you select an area on
screen using the mouse `MandelSquare' will
magnify to screen size. Note that the
resolution of the routines employed by
`MandelSquare' is limited and after a certain
number of magnifications the pictures
generated will look blurred or coarse, but the
program is guaranteed to perform reliably up
to screen resolutions of 1E-13
(0.0000000000001).
Detail................. If changing the number of iterations to be
used for picture generation, the user may want
to explore the new patterns and colours hidden
inside the areas of the picture `MandelSquare'
has left black. `MandelSquare' will check
each black pixel in the selected area and
recalculate its colour.
Recalculate............ The algorithm employed by `MandelSquare' is by
no means perfect: it will sometimes fill
rectangles which it should not and truncate
imagery. This happens rarely enough, but the
resulting picture can be corrected by
selecting selecting this menu item and by
marking the area to be recalculated. Each
pixel of the selected area will be
recalculated and set accordingly.
If the area selected is as wide as the
whole screen a special mode will be used to
render the pixels into fast ram. As soon as a
line is complete it will be copied from the
fast ram line buffer to the corresponding line
on screen. This is especially useful if
`MandelSquare' is running in high resolution
mode in which the display memory does not
respond quite as fast as real fast memory.
Precise Calculation.... If this option is in effect `MandelSquare'
will calculate the colours of all pixels on
the margins of a square which is to be filled
in a single colour. If these pixels all match
the same colour the square will be filled as
usual, if not the square will be divided into
four smaller squares and the calculation will
proceed. While this method is more precise
than the standard way it avoids rendering
errors and is recommended to use when
generating animations. As a drawback it
is slower than the standard method of
calculation.
Coordinates............ This menu item will open a control panel in
which the screen coordinates and size can be
adjusted manually by typing the approriate
floating point numbers.
Palette................ Selecting this menu item will open a palette
control panel in which three sliders are to
shift the red/green/blue colour tables the
screen palette is made of. Each colour table
represents the positive part of a sine wave
spread across 32/16 colors ranging from 0 to
15. Move the sliders to create more or less
interesting colour effects.
Spectral Colours....... If in effect this option causes `MandelSquare'
to use a special palette of 75 spectral
colours instead of the 32/16 colour palette to
be adjusted by the palette control panel.
Since not all 75 colours will fit on the
screen at one time, only a small part will be
visible. Which part to be displayed can be
adjusted using the left and right cursor keys.
Toggle Calculation..... Use this menu item to abort any calculation
currently in progress. If no calculation is
currently running, it will be restarted.
32-16384............... The number of iterations to be used when
generating a picture. The higher this number,
the longer the calculation will take and the
more patterns will be revealed in otherwise
black areas of the screen.
============================ Special keys ============================
======================================================================
Just like many other programs of this kind `MandelSquare' supports
colour cycling. The following keys control the cycling process:
Tab.................... Stops or restarts the colour cycling.
Cursor up.............. Starts the cycling in forward direction.
Cursor down............ Starts the cycling in reverse direction.
Cursor left............ Cycles the colour palette one entry backward.
Cursor right........... Cycles the colour palette one entry forward.
========================== Author's Request ==========================
======================================================================
Since I don't expect Commodore to sell more A3000(T/UX) machines, GVP
to sell more A3001 boards and PP&S, RCS and ACD to sell more '040
cards just because I happened to create `MandelSquare' I am releasing
this program and the accompanying source code as Freeware. The
program may not be sold for more than DM 5,- (3$ US) or the equivalent
in the local country's currency, but it may be copied for free as long
as my copyright remains untouched. If you like this program, send me
copy of the animations or pictures you created with it, a picture
postcard of your home town would be nice, too.
My `physical' address is:
Olaf Barthel
Brabeckstrasse 35
D-3000 Hannover 71
Federal Republic of Germany
My email adresses are:
Z-Net: O.BARTHEL@A-Link-H
Usenet: o.barthel@a-link-h.zer.sub.org
cbmvax.commodore.com!cbmehq!sourcery!olsen
Comments and suggestions how to improve this program are generally
appreciated!
============ Revision history (most recent change first) =============
======================================================================
1.3 Added the animation replay feature, removed the crosshair
mouse pointer, the colour transition tables are now generated
in a much simpler way than before, some basic calculation
logics have been modified to permit faster execution.
1.2 The calculation routine was slightly rewritten to allow for
earlier termination (old code used to go through the more
complicated calculations before actually noticing that it was
time to terminate). The `precise' calculation code should
work much faster now since the precalculation will now
terminate as soon as an odd pixel is encountered. The
animation code now sports much smoother camera zooms. Old
code used to bounce & accelerate when coming closer to the
selected square, the new code will always appear to approach
the square at the same speed. The zoom speed may be set to a
custom value and the zoom code actually precalculates the
number of frames to calculate before reaching the selected
square. I also added an option to have a box displayed around
the selected square whilst rendering the single frames (for
the `Powers of Ten' effect).
1.1 First public release.