Fractals/xaos

XaoS is an interactive fractal zoomer program written in C++ and JS. It allows the user to continuously zoom in or out of a fractal in real-time.

Here is unofficial wiki about XaoS. =Links=
 * github: xaos-project

=Algorithms=

Hubička algorithm
XaoS was originally just a "poorly written" Mandelbrot viewer until Jan Hubička added efficient zooming (= real time zoom ), using a technique sometimes called the XaoS algorithm or Hubička algorithm.

At the time fractal zoom movies were produced by completely recalculating each frame, even though they naturally had much of their area in common with each other. This made interactive zooming impossible without very powerful computers. Furthermore, unless even more processing is used in order to do antialiasing, recalculating every frame produces a 'twinkle' effect as small bright areas hit and then disappear between pixels.

Yet allowing the user to zoom, rather than jump as in Fractint, seemed like the most natural way to interact with fractals. In order to create an interactive zoom, Hubička needed to find a way to save the calculations which were already made. It would take up too much memory to save every pixel ever calculated, so the Hubička algorithm only saves the previous frame, and rather than remembering the location of each pixel it can keep them aligned in rows and columns and remember those instead.

The most difficult part of the XaoS algorithm was choosing which saved rows and columns to draw where. Doing this wrong results in distorted images, yet it must be done quickly to be useful. After several different heuristics were tried, eventually the problem was treated as an optimization problem.

The remaining rows and columns are colored in the same as the closest row/column, and are freshly calculated as the CPU gets time to do so. This is a careful balance between keeping the zoom going and increasing the level of detail. Calculating areas where the image is being zoomed to is put at a higher priority since these will be on the screen the longest and this is likely where the user is looking anyway. Zooming out, the reverse occurs and the priority is on the edges.

The Hubička algorithm can also be applied to zooming in on other images where the pixels are calculated, and has been used in other software such as the rtzme complex function graphing program, and other fractal zoomers.

=Images=
 * commons : Category:Fractals created with Xaos
 * commons Xaos gallery

=Command line options =

To find it use :

xaos -help

Output is :

XaoS3.5 help text (This help is genereated automagically. I am sorry for all inconvencies)

option string  param   description

-delay         number Delay screen updates (milliseconds) -driver        string Select driver -list           List available drivers. Then exit -config         Print configuration. Then exit -speedtest      Test speed of calculation loop. Then exit -threads       number Set number of threads (CPUs) to use -pipe          string Accept commands from pipe (use "-" for stdin) -maxframerate  number Maximal framerate (0 for unlimited - default)

Screen size options:

Knowledge of exact screen size makes random dot stereogram look better. Also is used for choosing correct view area

-screenwidth   f.point exact size of screen in centimeters -screenheight  f.point exact size of screen in centimeters

Use this option in case you use some kind of virtual screen or something similar that confuses previous options

-pixelwidth    f.point exact size of one pixel in centimeters -pixelheight   f.point exact size of one pixel in centimeters -formula       string user formula -forminit      string z0 for user formula

Animation rendering:

-render        string Render animation into seqence of .png files -basename      string Name for .png files (XaoS will add 4 digit number and extension -size          string                  widthxheight -renderimage    string                  256 or truecolor -renderframerate  f.point                  framerate -antialiasing    Perform antialiasing (slow, requires quite lot of memory) -alwaysrecalc    Always recalculate whole image (slowes down rendering, increases quality) -rendervectors   Render motion vectors (should be used for MPEG encoding) -iframedist     number                  Recommended distance between I frames in pat file (should be used for MPEG encoding)

X11 driver options:

-display       string Select display -size          string Select size of window (WIDTHxHEIGHT). -sync           Generate sync signals before looking for events. This helps on old and buggy HP-UX X servers. -shared         Use shared colormap on pseudocolor display. -usedefault     Use default visual if autodetection causes troubles. -nomitshm       Disable MITSHM extension. -fullscreen     Enable fullscreen mode. -windowid      number Use selected window. -window-id     number Use selected window. -root           Use root window.

AA driver options:

-aadriver      string Select display driver used by aa-lib -kbddriver     string Select keyboard driver used by aa-lib -mousedriver   string Select keyboard driver used by aa-lib -font          string Select font -width         number Set width -height        number Set height -minwidth      number Set minimal allowed width -minheight     number Set minimal allowed height -maxwidth      number Set maximal allowed width -maxheight     number Set maximal allowed height -recwidth      number Set recommended width -recheight     number Set recommended height -normal         enable usage of narmal characters -nonnormal       disable usage of normal characters -dim            enable usage of dim(half bright) characters -nodim          disable usage of dim(half bright) characters -bold           enable usage of bold(double bright) characters -nobold         disable usage of bold(double bright) characters -boldfont       enable usage of boldfont characters -noboldfont     disable usage of boldfont characters -reverse        enable usage of reversed characters -noreverse      disable usage of reversed characters -all            enable usage of reserved characters -eight          enable usage of non ansi characters -extended       enable usage of extended character set -inverse        enable inverse -bright        number set bright (0-255) -contrast      number set contrast (0-255) -gamma         f.point set famma (0-1) -nodither       Disable dithering -floyd_steinberg  Enable floyd steinberg dithering -error_distribution  Enable error distribution dithering -random        number Set random dithering value -dimmul        f.point Multiply factor for dim color (5.3) -boldmul       f.point Multiply factor for bold color (5.3) -nomouse        Disable mouse

Command line options only

-print_menus    print menus specifications of all menus -print_menu    string print menu specification -xshl_print_menustring print menu specification in xshl format -xshl_print_menus print all menu specifications in xshl format -print_dialog  string print dialog specification

File

-loadpos       input_file Load -savepos       output_file Save -record        output_file Record -play          input_file Replay -saveimg       output_file Save image -loadexample    Load random example -savecfg        Save configuration

Fractal

-usrform       string User formula -usrformInit   string User initialization -perturbation  real_number  real_number Perturbation -initstate      Reset to defaults -julia         on|off Julia mode -view          real_number real_number real_number real_number View -angle         real_number Set angle -plane         integer Set plane -incoloring    integer Inside coloring mode -outcoloring   integer Outside coloring mode -intcoloring   integer Inside truecolor coloring mode -outtcoloring  integer Outside truecolor coloring mode -juliaseed     real_number  real_number Julia seed

Calculation

-periodicity    Periodicity checking -maxiter       integer Iterations -bailout       real_number Bailout -fastjulia      Fast julia mode -range         integer Solid guessing range

Filters

-edge           Edge detection -edge2          Edge detection2 -threed         Pseudo 3d -starfield      Starfield -stereogram     Random dot stereogram -interlace      Interlace filter -blur           Motionblur -emboss         Emboss -palettef       Palette emulator -anti           Antialiasing -truecolor      Truecolor emulator

UI

-letterspersec integer Letters per second -autopilot      Autopilot -inhibittextoutput VJ mode -recalculate    Recalculate -interrupt      Interrupt -speed         real_number Zooming speed -fixedstep      Fixed step -nogui          Disable XaoS's builtin GUI -status         Status -ministatus     Ministatus

Misc

-playstr       string Play string -text          string Display text -color         white|black|red Color -textposition  left|center|right top|middle|bottom Text position -message       string Message

Help

-help           Help

Formulae

-mandel         Mandelbrot -mandel3        Mandelbrot^3 -mandel4        Mandelbrot^4 -mandel5        Mandelbrot^5 -mandel6        Mandelbrot^6 -newton         Newton -newton4        Newton^4 -barnsley       Barnsley1 -barnsley2      Barnsley2 -barnsley3      Barnsley3 -octal          Octal -phoenix        Phoenix -magnet         Magnet -magnet2        Magnet2

More formulae

-trice          Triceratops -catseye        Catseye -mbar           Mandelbar -mlambda        Lambda -manowar        Manowar -spider         Spider -sier           Sierpinski -carpet         S.Carpet -koch           Koch Snowflake -hornflake      Spidron hornflake -user           User defined

Palette

-defpalette     Default palette -randompalette  Random palette -palette       integer integer integer Custom palette -cycling        Color cycling -cyclingspeed  integer Color cycling speed -shiftpalette  integer Shift palette

Dynamic resolution

-fastmode      zero|never|animation|new|allways Dynamic resolution mode

Rotation

-rotationspeed real_number Rotation speed -autorotate    on|off Automatic rotation -fastrotate    on|off Fast rotation mode

Quit

-quit           Exit now

= Files=

xaf
Xaos Animnation File (*.xaf ) is a file with functions for generating sequence of images For example :

xaos-3.5/tutorial/julia.xaf

To make xaf file use record function, syntax :

(record bool [ file ])

example :

(record #t)

or :

(record #f)

How to render image sequence from xaf file :

xaos -render [xpf_filename] -size 352x240 -antialiasing -renderframerate 24 -basename [basename]

xpf
xpf stands for Xaos Position File. This file is human-readable, and can easily be improved by hand after saving, or used as a base for animations.

See for example :

standard view (Mandelbrot set without zoom = image) :

;Position file automatically generated by XaoS 3.5 ; - a real-time interactive fractal zoomer ;Use xaos -load to display it (initstate) (defaultpalette 0) (formula 'mandel) (view -0.75 0 2.5 2.5)

when we switch to Julia mode (disabled Mandelbrot mode) :

(initstate) (defaultpalette 0) (formula 'mandel) (julia #t) (view -0.75 0 2.5 2.5)

or change c value ( = julia seed)from c=0 to  c= -1

(initstate) (defaultpalette 0) (formula 'mandel) (juliaseed -1 0) (julia #t) (view -0.8434 0.07535 2.744 2.744)

or show plane value ( default = 0 is not shown ) :

(initstate) (defaultpalette 0) (formula 'mandel) (juliaseed -1 0) (julia #t) (plane 0) (view -0.9127 -0.09268 2.285 2.285)

minibrot.xpf : (initstate) (palette 1 860134713 0) (formula 'mandel) (outcoloring 1) (view -1.9854567 -1.351727E-05 0.00029196024 0.00029196024)

where view is describing viewport ( rectangle part of the plane ): view float float float float view centerRe centerIm radius angle

List of xpf files :
 * list by by Chris Gray Some Fractals Computed by XaoS with xpf files by Chris Gray

view
to describe plane ( view ) Xaos uses:
 * 4 numbers in scripts
 * 3 numbers in menu

Xaos uses to call it "radius" but it is defind as : the greater of (x2-x1= width) and y2-y1=height." This is the reason why in Xaos  one can set the radius to 2/zoom.

To set the same viewpoint in XaoS using menu set 3 numbers to define circle
 * the real portion of the center to (x1+x2)/2
 * the imaginary part of center to (y1+y2)/2
 * "the radius" = the greater of x2-x1 and y2-y1.

where the coordinates of the upper-left and lower-right visible points, specifying the coordinates as four numbers x1, y1, x2, y2.

In xpf file plane can be described by 4 floating point numbers :
 * real part of the center
 * imaginary part of the center
 * width in world coordinate = x2-x1 called "a real radius"
 * height in world coordinte = y2-y1 called "an imaginary radius"

Syntax :

(view float float float float)

Example :

(view -0.75 0 2.5 2.5)

"People specify fractal coordinates in many ways. Some people use the coordinates of the upper-left and lower-right visible points, specifying the coordinates as four numbers x1, y1, x2, y2. To set the same viewpoint in XaoS, set the real portion of the center to (x1+x2)/2, the imaginary   part of center to (y1+y2)/2, and the radius to the greater of x2-x1 and y2-y1. Other programs use a zoom factor instead of a radius. For these, you can set the radius to 2/zoom."

" ... lets you specify an ellipse instead of a circle. You can specify both a real and an imaginary radius "

usrform
(initstate) (defaultpalette 0) (formula 'user) (usrform "Z^2+C") (usrformInit "") (view -0.4641 0.01977 2.444 2.444)

bailout
(bailout 6)

Bailout value or escape radius. Xaos uses here square of escape radius so if you want bailout value 2 put here 2*2 = 4.

formula
Syntax: (formula keyword)

example

(formula mandel)

Changing named formule ( Menu/Fractal/Formule ) does not change user formule !!!

plane
Syntax :

(plane integer)

Allowed values :

perturbation
It changes the point at which orbits start. Traditionally zero is used.

(perturbation complex)

=doc =

info xaosdev.info

How to render big images ?
It is not simple. One can do it using :
 * using animation thru menu ( "saving your fractal to a .xpf file (File->Save), then rendering it using the Misc->Render Animation function. "
 * using command line options

XaoS -render fractal.xpf -size 18000x12000

How to change the resolution
"XaoS usually starts in low resolution (320x200 or so) to make calculations faster. In case you have fast computer or you need to save bigger .gif images you may change resolution. This should be done by pressing '=' in full screen drivers or simply by resizing XaoS window."

Formula

 * use xpf file
 * use Main Menu/ Fractal/user formula
 * Adding Built-in Formulas
 * edit the source code in src/engine/formulas.c

formulas.c
After modifying the code you must recompile XaoS to take any effect.

=References=