The objects can be colored by linking space coordinates (or other parameters in version 1.0) to colors using a mathematical formula. The palette of colors can consist of up to 50 colors or color ranges.
Additionally it is possible to define intersection planes. With this feature the internal construction of the fractals can be displayed. Of course, especially interesting is an intersection with the complex plane: you get the usual two-dimensional fractal as intersection object how it could also be calculated by "Fractint" for example. Moreover it can be seen how different regions of the two-dimensional fractal are connected together in three-dimensional space.
A screenshot of Quat 1.0 (under Linux):
Normally, the the picture is calculated and saved in 24bit true color, but it can be displayed in 256 color during calculation (however in poorer quality).
The fractals calculated with Quat correspond exactly to the usual, two-
dimensional "julia sets", which almost every fractal program can calculate.
(As iteration formulas available are "Classical Julia" xn+1
= xn2 - c and "Lambda Julia" xn+1=cxn(1-xn)
; x0 represents the pixel being calculated.)
To achieve the third dimension, Quat uses the so-called "Hamiltonian
quaternions" instead of the complex numbers with two components (real and
imaginary part). The "quaternions" are a generalization of the complex
numbers and consist of 4 components (1 real part, 3 imaginary parts). If
you set the 2 additional components to zero, you get the usual complex
numbers. Using quaternions (by the way, the name "Quat" is derived from
"quaternions") it would be possible to calculate even four-dimensional
fractals, nevertheless, only three-dimensional ones are really calculated.
(If somebody invents a four-dimensional monitor, I will agree to change
my program accordingly... :-) )
Generation of a really three dimensional view is possible (3d stereo). The fractal can be seen three dimensional without any utilities like 3d glasses.
The output format is the PNG format. It is the successor of GIF and offers - like GIF - compression of image data without loss of quality (JPEG compresses better, but the quality gets worse). More information on PNG: http://www.cdrom.com/pub/png. Because of the fact that PNG allows the storage of data specific to the application, Quat saves all data neccessary for the generation of the image within the PNG picture.
Quat uses a library named "ZLIB" to write the PNG-files. This library is a compression library and has nothing to do with fractal calculation. It was written by Jean-loup Gailly and Mark Adler. More information on ZLIB: http://www.cdrom.com/pub/infozip/zlib
The user interface was implemented using the portable "Fast Light Toolkit"
(FLTK). The hompepage of this project is located at
http://www.fltk.org
Quat is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Special thanks to Max Schwoerer for the clarification of some of the
juridical questions, and to Oliver Siemoneit for his help on the English
translation.
Many thanks to Larry Berlin (lberlin@sonic.net)
for his advice in stereo view related topics, his many ideas for how to
improve the program (especially the user interface), his testing of pre-release
versions of Quat 0.92.
Larry Berlin maintains a great 3D-ezine (http://3dzine.simplenet.com/3dzine.html).
He plans to show a gallery of images he derived from objects generated
by Quat. I had the chance to see some examples. Really worth visiting!
Thanks to Eva-Maria von Garrel for testing.
The requirements for the pre-compiled versions of Quat are:
A point in this context is a complex number (in case of a two-dimensional fractal). A complex number consist of two components, which are independent of each other. They are called real and imaginary part. If the imaginary part is zero, the complex numbers are identical to the real numbers (e.g. 1.23324, -23, ...). To mark the imaginary part, the letter "i" is used. There is one rule: i*i=-1. (This fact shows, that "i" can't be a real number, because no real number multiplied with itself is -1.) In general a complex number "c" is written like this: c = a + i*b, where "a" is the real part and "b" is the imaginary part (both are real numbers). In two-dimensional fractal programs the real part is identified with the X coordinate on the screen, the imaginary part with the Y coordinate.
Quat needs numbers which have one component more to calculate its fractals. This component is necessary for the Z coordinate. Such numbers don't exist, but there are numbers with four components: the Hamiltonian quaternions (sometimes also called "hypercomplex numbers"). They consist of one real part and three imaginary parts. The signs for these parts are e, j, k and l. "e" corresponds to the real part (e equals to 1), "j" to the imaginary part of the complex numbers. In case k- and l-part are zero, we again have the good old complex numbers. There are special multiplication rules for e, j, k and l. (These rules reveal a difference between quaternions and hypercomplex numbers, but it isn't of any importance for this section. Quat uses quaternions, but for simplicity I'll use both names exchangeable.)
Four components would allow even four-dimensional fractals, but for practical reasons (see above) and the limitations of human mind (_not_ the programmer's incapacity...), Quat is "only" able to render three-dimensional fractals. The additional fourth dimension (fourth component) is set to a constant value, which is defined by the parameter "lvalue" in the OBJ-file (User interface versions: in the Object Editor). This proceeding produces a three-dimensional intersection of a four-dimensional fractal analogous to the two-dimensional intersection of the three-dimensional fractals calculated by Quat which is made by common fractal programs.
Back to our iteration formula. Quat uses one of the following formulas
(among others):
xn+1 = xn2 - c; or xn+1
= c*xn*(1-xn)
x0 is the starting-value ( = point that has to be calculated)
"n" is a count index which numbers the "x" (n=0,1,2,3...).
The value "c" in the formula is a hypercomplex number, that remains
constant during the whole calculation. This is defined in the Object Editor/OBJ-file
as parameter "c". "c" determines the shape of the fractal.
One could see that the sequence of all xn defined by the iteration formula (also called "orbit") can show three different schemes:
This formulation isn't completely exact: there is the problem that a computer can't do the calculation up to infinity to see whether the sequence converges or not. (The reason is the limitation of human life, again not incapacity of the programmer :-) ). Because of this the calculation is stopped after a previously defined number of iterations. This number is set in the Object Editor/OBJ-file through the parameter "maxiter". But how does Quat know after maxiter iterations whether the sequence goes to infinity or not? Thus there is the value "bailout" (naming freely after "Fractint"). If this value was exceeded during the maxiter iterations, it is assumed that the sequence goes towards infinity.
Now we are able to describe the calculated object exactly: It is the amount of all points ( = numbers) x0, for which the sequence defined by the iteration formula of the xn didn't exceed the value "bailout" after at most "maxiter" iterations. (How complicated nice shapes are described mathematically... On the other hand: How nice mathematics can be!)
But to calm you down a little bit: those who don't understand all this or who simply are not interested in it can, nevertheless, calculate nice pictures.
As a result we have two different coordinate systems: First, the system that has to be displayed (the Q-Space), second, the system on which is projected (view plane, monitor).
The Q-Space is defined by three axes, called e, j and k, analogous to the components of hypercomplex numbers (the l-part is set to a constant value, see above). The e-axis is the real axis ("ray of numbers"), the plane defined by e- and j-axis is the complex plane, in which 2D fractal programs calculate their fractals.
On the view plane there are two axes of the view coordinate system, called X and Y axis, which correspond to the horizontal and vertical direction of the monitor. Additional there is a Z axis, which points perpendiculary away from the view plane and into the direction of the fractal.
Regarding the fact that fractal objects are always around the origin of the Q-Space, the following way to construct the view plane seems obvious. There is a point in Q-Space defined in the initialization file, the "view point". The view plane goes through the view point and is perpendicular on the vector from the origin to "view point". ("view point" has a double meaning: it defines position and orientation of the view plane). The view point defines the Z axis of the view coordinate system. Henceforth we will move only on the so defined view plane.
Now there has to be taken a rectangular window on the view plane (= the view window), which is oriented in the way that two opposite lines of the rectangle are parallel to the projection of the "up vector" (see later) on the view plane. The direction of this projection is called Y direction and corresponds to the vertical direction on the monitor. The horizontal direction is called X direction and corresponds to the two other lines of the rectangle. As we see, the "up vector" defines where is up. Accordingly the directions of X and Y axis have been defined through this.
The diagonals of the view window/rectangle intersect in the "view point" (This means that the view point lies in the "middle" of the screen/view window). Now the view window is scaled around the view point as follows: the side which is the X direction gets the length "lxr" (measured in Q-Space, see parameter "lxr") and the relation between the lengths X and Y gets the same value as the relation between the X and Y resolutions (see parameter "resolution"). (to achieve display without distortment). The base vectors of the view window (derived from X and Y directions) get the length 1. Now we are ready. The view coordinate system is defined completely.
To get all possible positions of the view window (up to now every describable plane is oriented around the origin), the view plane is shifted in X and Y direction to the amount of the values given through the parameter "move" (it's a movement in the view plane's own coordinate system).
Chart 1: Different ways to an image
ZBuffers open a wide field of experimentation, you can find out the
best look of the object by trying some different looks.
ZBuffers have the suffix "ZPN". The full set of parameters is stored
in it, as well as in images (PNG). ZBuffers are quite usual PNG files,
but they don't contain an image. Some graphics programs even recognize
them and display them very easily when they are opened, some other need
the suffix to be changed to "PNG". I don't know if it makes sense to directly
view ZBuffers, because one can't do anything with the data stored therein.
"Image" menu:
Image | Open...
Opens an image (PNG file), shows it and reads the parameters stored
in it. Quat shows how much of the image is already calculated afterwards.
You may get the error message "PNG file has no QUAT chunk". This happens
if you try to open a PNG written by another program. In this case Quat
can't read the fractal parameters.
Note: In 256 color modes you should use a specialized program to view
the image, because it can do a better job with the limited amount of colors.
"Graphic Workshop for Windows 1.1u" or "Paintshop Pro" support PNG images
(Windows), also "XV 3.10a" with the PNG-patch (X).
Image | Close
Closes the image, but leaves the parameters in memory. If you want
to change some parameters of an image and want to recalculate it, you must
first close the image, then change the parameters and as last step start
the calculation.
Image | Save
Save the image (PNG) using the name shown in the title bar. Often this
is a name generated automatically with a number at the end.
All parameters needed for recalculation of the image are stored along
with the image.
Image | Save As...
Like "Image | Save", but uses a custom name for the image. You can
enter the name in the dialog which opens after selecting this command.
Image | Adjust Window
Sets the window size to the size of the image (as long as it fits on
screen)
Image | About
Shows information on Quat.
Image | Exit
Exits from Quat.
"Calculation" menu:
Calculation | Start/Resume an image:
Starts a calculation of an image using the current parameters (see
"Parameters" menu) or resumes a stopped one. If you have a Z buffer open
(which must be calculated completely), you can turn it into an image using
this option. (See section 2.3)
An image is a fractal object which is lighted and colored, as opposed
to a Z buffer.
Calculation | Start/Resume a ZBuffer:
Starts a calculation of a Z buffer using the current parameters (see
"Parameters" menu) or resumes a stopped one.
A Z buffer has the shape of the fractal object, but has no colors and
is not lighted. Calculating a Z buffer does most of the calculation, turning
a Z buffer into an image is relatively fast. The advantage is, that you
can still change the parameters (colors, light) that don't affect the shape
of the fractal and render an image in a short time. If you don't like the
appearance of the object, simply close the image, which will return you
to the Z buffer. See section 2.3 for more information
on Z buffers.
Calculation | Stop:
Stop the running calculation (of both an image and a Z buffer). You
can resume calculation, see the two menu points above.
"Parameters" menu:
Parameters | Reset:
Resets the parameters to their default values. If you calculate an
image with these values, you will get a sphere.
Parameters | Read from INI:
Reads in the parameters for creating an image. It doesn't reset
the parameters to default values first! (Use "Reset" to do this.)
The INI file may have been created by "Save As..." or with a text editor.
An INI file holds data necessary to generate an image.
You can also read in a COL file previously saved in the Color Editor.
Parameters | Read from PNG:
All data necessary for image generation is stored in the image itself
(according to PNG specification). This menu point reads the parameters
from the image for re-generation or editing.
Parameters | Save As:
Writes the parameters to an INI file, which is a simple text file that
can be edited with a text editor. You can use this option if you want to
calculate the image with the text version of Quat. (Text versions use INI
files to get the parameters they need.)
The editors (in which you can edit the parameters):
Parameters | Edit...:
The so-called "Parameter Editor" dialog opens, which looks as follows
(shown here: X-Window-version with KDE Window Manager, the tab "Object"
is selected):
In this dialog you can specify all parameters the are used to calculate
the image. Additionally, you can get a preview for the parameters entered
currently.
Using the tabs, you can select which kind of parameters to change:
The fractal is calculated as it would look like for the currently chosen
parameters in the Preview window. This is good for experimenting, because
it is often difficult to predict the effect of changing a parameter.
The button "Do!" calculates the preview and shows it right of it. If
the button "own" is active at the same time you press "Do!" (yellow light),
the currently entered parameters are used for the preview (of course, except
resolution and anti-aliasing). If "own" is not active, a standardized view
of the fractal is calculated. This can be useful if you, for example, have
"lost your way", or by error selected black as the only color.
If there's entered a non-zero "interocular distance" in the View Editor,
you can choose a stereo preview using the button "Stereo". It's slower,
but three dimensionally. By the way, in that case the real image will be
in stereo always.
Actually, the view selectors are an addition to the View Editor, but because there is not enough space, they've been placed in the common area of the Parameter Editor. For how to use them, see explanation of View Editor.
The action buttons correspond to the commands in the "Parameters" menu, so they allow to read an INI file, write the parameters (or some of them) to an INI file, to reset the parameters or to import them from a PNG file.
The Object Editor
In this dialog you can specify the fractal data of the object. This
data determines the shape of the fractal. You can enter values for following
keywords: "Maximum iteration (maxiter)", "4th-dim.
Intersection (lvalue)", "bailout" and "c".
(See their description in Section 4.1).
You see a "Mandel Preview" which shows the Mandelbrot set (or, more exactly, two dimensional intersections of the four dimensional generalization of the Mandelbrot set). This set can be seen as a map for "Julia sets" (the objects being calculated by Quat). The red cross marks the selected point "c". Every point "c" generates another Julia set. Points that lie in the Mandelbrot set (the black figure) lead to connected Julia sets, the other case they are split up.
You can click or drag with the mouse into the Mandelbrot Preview to
move the red cross. The values for the first two parts of "c" are updated
accordingly.
If it's necessary to update the Mandel Preview, it gets a red border.
Then you can click the button "redraw". This is necessary, if, for example,
one of the parameters "maxiter", "bailout" or the last two parts of "c"
have been changed.
The six buttons below the Mandel Preview serve the navigation in the
Mandelbrot Preview. You can move and zoom the section that is shown.
The upmost button "up" moves the viewable section up, the downmost
down. The one on the left moves left, on the right right. The two buttons
in the middle zoom in "+" and out "-".
The View Editor
The Parameter Editor with selected View tab looks as follows (shown:
Windows version)
Here is the place to define how the object should be viewed. A view plane (on which the fractal gets projected) is defined by the parameters "viewpoint", "up", "move", "lxr" and "interocular". The "light"-source is also defined. (See descriptions in Section 4.1).
Below the edit control for "interocular distance" there is an angle shown. You can choose whether to keep the distance or the angle while changing the viewpoint. This angle should be between 5 and 8 degrees if you want to create a 3D stereo image pair. If interocular is zero (and thus the angle is also zero), a 2D projection of the fractal object is generated.
Because it would be boring if you could only enter values you could
also enter in a text editor (INI file), there are three views of the view
point in the Parameter Editor. (You look at it "from above", "from beside"
and "from front".) The black arrows are the axes in Quaternion space (or
the three-dimensional sub-space defined by "lvalue" [Object Editor].) "1"
is the usual real axis, "i" the imaginary axis (same as with complex numbers;
These two are used by every 2D fractal program) and "j" points into the
third dimension (there is no "k" axis as the value for k is constant ["lvalue"]).
The arrows point in the direction of positive values, the length of
an arrows corresponds to the length 2 in Q-space.
The blue rectangle marks the view point, the green rectangle shows
the size of the view plane. You can click into the blue rectangle and drag
it to a position of your choice to change the view point. Some positions
are not defined (if the view point is (0,0,0) or if the "up" vector is
perpendicular to the view plane). In this case the controls which are responsible
for it are highlighted red.
The small cyan circle is the origin of the view coordinate system (=
the upper left point on screen)
The Color Editor:
Here's a screenshot of the Parameter Editor with selected Color tab
(Linux version):
If you want to specify colors (or better, color ranges), do it here. At the top you see a scroll bar which you can use to select the color range you want to edit. You can either click directly on the color range to edit, or use the arrow buttons next to it.
Below, in the left column, there are two buttons, "Add" and "Del". "Add" adds a color range before the current position in the palette, "Del" deletes the active color. There has to be at least one color, and not more than 30. For each color range you can enter values for the start color ("Color 1"), the end color ("Color 2") and a weighting for the color range. The weight defines how much of the palette is made of the selected color range. This last value must not be zero. (See also section 4.2).
If you click the button "Sel" next to each color, you get a color selection dialog. If you don't want to create a color range but only a color, set both colors (Color 1 and Color 2) of the color range to the same values.
"Copy" copies the corresponding color into the clipboard (not into the global one of Windows/X, but into the rectangle in the upper right corner). "Paste" replaces the corresponding color with the color in the clipboard.
Below you can enter the color scheme formula either directly or by choosing one of the predefined formulas. (See key word "colorscheme")
The Intersection Editor:
A screenshot of the Intersection Editor (Linux version):
Is used to define intersection planes. The scroll bar on the left has the same purpose as the one in the "Color Editor" described above: to select the object to edit. The buttons "Add" and "Del" also work like above, one adds a new plane, the other deletes the selected plane. There may be between 0 and 20 intersection planes. A plane is defined by its normal vector (pointing into the half-space in that the object should disappear) which must not be zero, and a point on that plane. (See also section 4.3)
Parameters | Other Parameters:
Other Parameters are "resolution", "phong",
"ambient" and "antialiasing".
See section
4.4 for the first one, and section 4.1
for the last three.
In the Dialog there are five buttons (Resolution shortcuts). If you
hit one of them the resolution is set accordingly to the button hit.
ZBuffer menu:
To learn more about Z Buffers, please read section 2.3. The commands in this menu are for opening, saving, saving as and closing a Z Buffer.
-i <ini file> | calculates an image from an ini file. (Ini files are used for feeding Quat with the values it needs to start a calculation) |
-z <ini file> | calculates a Z buffer (suffix ZPN) from an ini file. |
-i <zpn file> | generates an image by using a precalculated Z buffer. (This of course is much faster than calculate from an ini file.) |
-i <zpn file> <ini file> | generates an image from a Z buffer, but replaces certain parameters (coloring e.g.) with the values given in the ini file. |
-p <png or zpn file> | reads the parameters that have been used to calculate the image/zbuffer and writes them to an ini file. |
-c <png or zpn file> | continues calculation of an unfinished image. The ini file that has been used to generate the image is not needed. |
-h | shows short information. |
A call looks like this:
quat -i test.ini
A calculation is stopped by
0 | Classical Julia | xn+1 = xn2 - c |
1 | Lambda Julia | xn+1 = cxn(1-xn) | 2 | xn+1 = xn*ln(xn) - c |
3 | Cubic Julia | xn+1 = xn3 - c |
4 | xn+1 = xnp1 - c |
Special functions for fractal calculation are:
orbite(n): The e-part of the Quaternion after n iterations.
orbitj(n): The j-part of the Quaternion after n iterations.
orbitk(n), orbitl(n): same.
![]() |
![]() |
![]() |
Image 1: This is an example for a depth resolution
that is too low (240): "resolution 320 240 240". You see the frayed edges
of the blue parts of the object. There the object is so thin that it is
not hit by a calculation with z-resolution of 240.
No antialiasing is done: "antialiasing 1" |
Image 2: This image has an increased z-resolution
(2048): "resolution 320 240 2048". The edges are no longer frayed out.
Nevertheless you can see disturbing patterns of pixels caused by the so-called Moire-effect (on the orange parts of the image e.g.). They could be reduced by antialiasing, which is not done in this example: "antialiasing 1" |
Image 3: Here is the image for reference.
It has a z-resolution that is high enough (2048): "resolution 320 240 2048" like the image on the left. Additional it has an antialiasing value of 4: "antialiasing 4", which means that every pixel is the average of 4x4 sub-pixels. |
Look at the example image above. Sit in front of the screen at the distance
you usually work at, and then hold your thumb between screen and your eyes
(nearer to the eyes than to the screen). You should sit straight in front
of the screen, not incline your head and not look from beside at the screen.
Now look at the thumb as usual. Pay attention to the images on the screen
(without looking at them directly, always look at the thumb!)
If you see four images now, then the thumb is too near to the eyes.
Move it a bit further away from the eyes and look at it again as usual,
while paying attention to the background. Change the distance thumb-eyes
until you only see three images. Now the one in the middle is seen three
dimensional, but perhaps not sharp. To get a sharp image is a matter of
concentration, with increasing experience it gets easier. Watch the non-sharp
image for a while (but don't look at it directly). There'll be a point
at which mind begins to recognize, that the data that it gets, make really
sense and it tries to make it sharp. For some people this process is a
bit difficult (as it was for me), others have no problem with it.
By the way, this way to view is not an exotic feature of Quat, in the
Internet such stereo images are widely used. This way it is possible to
display a photograph of a landscape three dimensionally, for example
To start a calculation in the text only versions, a so-called "initialization
file" is needed, in which the object, the view, the colors and intersection
planes are defined. This file (and all that are "included", see below)
are simple text files, which can be written in any common text-editor,
(for example, "edit" with DOS, "notepad" with Windows, "vi" with Unix).
The syntax used is very simple, in every line there is a keyword with a
list of parameters following. (e.g., "viewpoint 0 0 1" defines the viewpoint)
In this initialization file you can include other files automatically
(by using the keyword "include"). This makes it possible to define color
ranges seperate from fractal data or intersection planes (in files with
a different suffix, e.g.). If such a file is included at a special location
in the initialization file, it is the same as if its contents would be
typed in at this location. The initialization file is only required to
start the calculation. Once a PNG file has been created, they aren't needed
any more. The fractal data is stored in the PNG file itself an can be reconstructed
from it.
Suggestion of how to separate the data in different files:
INI this file suffix type is given by Quat. Is is
the initialization file. All the information needed to generate an image
can be saved in it. It is also possible to "include" other files (as suggested
here).
OBJ Fractal parameters determining shape and viewpoint,
from which the object is shown and some raytracing parameters, which specify
the illumination, are defined in files with this suffix.
COL stores color or color-range of the object
CUT These files serve for the declaration of a intersection
plane configuration. (in most cases probably only a single intersection
plane).
This concept may appear a little bit complicated on the first view, but it offers high flexibility. For example, it allows to give the fractal other colors very quickly, or to add some intersection planes without changing something on the object-definition itself: Only one line in the INI-file has to be changed. But for those who still think this to be too complicated: You can use all keywords in the initialization file, too.