Fractals/fractint

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Fractint is a freeware computer program that can render and display many kinds of fractals. Source code is available

Authors[edit]

The primary authors of Fractint 19.5 are:

  • Bert Tyler
  • Timothy Wegner
  • Jonathan Osuch
  • Wesley Loewer

Images[edit]

commons:Category:Fractals created with Fractint

Fractint parameters[edit]

Fractint image information

Image Calculation Parameters[edit]

 CORNERS=[xmin/xmax/ymin/ymax[/x3rd/y3rd]]

"Example: corners=-0.739/-0.736/0.288/0.291 Begin with these coordinates as the range of x and y coordinates, rather than the default values of (for type=mandel) -2.0/2.0/-1.5/1.5. When you specify four values (the usual case), this defines a rectangle: x- coordinates are mapped to the screen, left to right, from xmin to xmax, y-coordinates are mapped to the screen, bottom to top, from ymin to ymax. Six parameters can be used to describe any rotated or stretched parallelogram: (xmin,ymax) are the coordinates used for the top-left corner of the screen, (xmax,ymin) for the bottom-right corner, and (x3rd,y3rd) for the bottom-left. Entering just "CORNERS=" tells Fractint to use this form (the default mode) rather than CENTER-MAG (see below) when saving parameters with the [B] command."[1]

 CENTER-MAG=[Xctr/Yctr/Mag[/Xmagfactor/Rotation/Skew]]

"This is an alternative way to enter corners as a center point and a magnification that is popular with some fractal programs and publications. Entering just "CENTER-MAG=" tells Fractint to use this form rather than CORNERS (see above) when saving parameters with the [B] command. The [TAB] status display shows the "corners" in both forms. When you specify three values (the usual case), this defines a rectangle: (Xctr, Yctr) specifies the coordinates of the center of the image while Mag indicates the amount of magnification to use. Six parameters can be used to describe any rotated or stretched parallelogram: Xmagfactor tells how many times bigger the x- magnification is than the y-magnification, Rotation indicates how many degrees the image has been turned, and Skew tells how many degrees the image is leaning over. Positive angles will rotate and skew the image counter-clockwise."

Mag indicates the amount of magnification to use. Initial value ( no zoom ) is 6.66666667e-01. "If the magnification is set to 1, the range on the Y axis is +1 to -1 - this is zoomed in too much and cuts off some of the top & bottom bulbs on the Mandelbrot set. With magnification set to .666666667, the range on the Y axis is +1.5 to -1.5, which gives a view of the complete Mandelbrot set. " (Ryan Davenport )[2]

/* 
frames.c - frames for endless zoom 
http://www.nahee.com/spanky/www/fractint/loewer/frames.c
Results of Wesley Loewer's Study : 
"The C program, frames.c, was used to generate the batch file, using "frames > tmp.bat" at the command line prompt.   I put the following in my sstools.ini and then ran tmp.bat.

      batch=y
      video=f3
      sound=off
      float=y
      passes=b
      viewwindows=///128/128 
      maxiter=1000
      colors=000_HcaDhc9n<2>YGkD_HEdH76H<2>50GTWJ<2>YLZA7F<73>YQo\
      000<75>IdU111<36>igu102<14>SAi000<13>5815917105A1<14>AJ3
When I stitched them together in an animation, the last frame looks just like the first frame."

*/
 
#include <stdio.h>
#include <math.h>

main(int argc, char *argv[])
{
	int frame, frames;
	double zoom, relzoom, zoomfactor;

    zoom = 1e5; /* seems like a deep enough starting place */
	relzoom = pow(2.0, 2.5*8); /* 2**(2.5 * 8 steps/lap ) */
	frames = 100;
	zoomfactor = pow(relzoom, 1.0 / (frames - 1));
	for (frame = 0; frame < frames; frame++)
	{
		printf("fractint center-mag=0/1/%g\n", zoom);
		zoom *= zoomfactor;
	}
	return 0;
}
/* 
frames45.c - frames at 45 degree increments using autokey option 
http://www.nahee.com/spanky/www/fractint/loewer/frames45.c
Results of Wesley Loewer's Study : 
"The C file, frames45.c, generates an auto.key script to produce the whole sequence of frames via FractInt's "g" command.   
After compiling frames45.c, at the command line prompt, just enter "frames45 > auto.key".   
Then I started FractInt with:

      video=af3 
      float=y
      viewwindows=///128/128 
      passes=b 
      maxiter=5000
      autokey=play
and away it went. "
*/

#include <stdio.h>
#include <math.h>

main(int argc, char *argv[])
{
	int angle, frame, frames;
	double zoomfactor, zoom;

	frames = 100;
	zoomfactor = pow(2.0, 2.5);
	zoom = 1.0; /* looks like a good starting place */
	angle = 0;
	for (frame = 0; frame < frames; frame++)
	{
		printf(
"\"g\"\n"
"\"center-mag=0/1/%g/1.333333/%d\"\n"
"ENTER\n"
"CALCWAIT\n"
"\"s\"\n"
"CALCWAIT\n"
"\"eh..\"\n"
"ESC\n\n"

			, zoom, angle);
		zoom *= zoomfactor;
		angle = (angle + 45) % 360;
	}
	return 0;
}

fractint files[edit]

Most important files are :

map[edit]


One can use/check Fractint map files in Gnuplot:

 set palette file "Skydye07.map" using ($1/255):($2/255):($3/255) # Read in a palette of RGB triples each in range [0,255]
 test palette
Fractint_default_colour_map


See also:

  • M Sargent: MAPView : This is a stand-alone program that displays the color spectrum of any selected MAP file.
  • M Sargent: MAP file collection - Fractint 256-color MAP files ( color palettes). They are text files containing RGB triplets, which are easy to create or edit. This ZIP archive contains a small collection. There are hundreds if not thousands of these files available on the Web. The programs allow you to select MAP files from their GUI menus, and usually show a preview of their color spectra.

par[edit]

"Fractint uses Parameter files[5][6] to save/restore all options and settings,[7] required to recreate particular images. The parameters required to describe an image require very little disk space, especially compared with saving the image itself. " [8]

Parameter files contain named groups of parameters, looking something like this:


    name { ; main comment 
         ....
         } 
      
    quickdraw {      ; a set of parameters named quickdraw
       maxiter=150
       float=no
       }
    slowdraw {       ; another set of parameters named slowdraw
       maxiter=2000
       float=yes
       }

These sections are called parset sections and describe a fractal equation, a view area, parameters and a color palette.[9]

For standard view of parameter plane and Mandelbrot set :

Mandel_Demo        { ; PAR for initialization of Fractint demo
  reset=1900 type=mandel corners=-2.5/1.5/-1.5/1.5 params=0/0 inside=0
  sound=no
  }

or :[10]

1_01                  { ; quite good spirals 
  reset=2000 type=mandel passes=1
  corners=-0.6014129278/-0.5990935452/0.427747516/0.429487053
  params=0/0 float=y maxiter=1000 inside=0 outside=15
  distest=1/10/320/200 
  }

1_02                  { ; stringy one, with dist estimator
  reset=2000 type=mandel passes=1
  corners=-1.9228429644992/-1.9228427944992/-6.3749991620026e-008/6.375000\
  8379971e-008 params=0/0 float=y maxiter=1000 inside=0 outside=15
  distest=1/20/320/200
  }

1_03                  { ; OK, bit dull, not zoomed in far 
  reset=2000 type=mandel passes=1
  corners=0.3734922373/0.3820837907/-0.243292645/-0.23684898
  params=0/0 float=y maxiter=1000 inside=0 outside=15
  distest=1/10/320/200
  }

1_04                  { ; a mess, needs dist est
  reset=2000 type=mandel passes=1
  corners=-1.862224008886682/-1.86222400040936/-3.214020831358832e-009/3.1\
  43970347410528e-009 params=0/0 float=y maxiter=1000 inside=0
  outside=15 distest=1/10/320/200 
  }

1_05                  { ; A twirly twiddly one 
  reset=2000 type=mandel passes=1
  corners=-0.77464016774366/-0.77463987034365/0.12426328506998/0.124263508\
  11999 params=0/0 float=y maxiter=1000 inside=0 outside=15
  distest=1/10/320/200 
  }

Parameter file for FractInt ( extension PAR) :

top-mag1500      { ; a really really deep zoom        Wesley Loewer
                   ; highly self similar
                  ; took over 1200 hours at 320x240 on a 486sx/25
                  reset=1920 type=mandel passes=b center-mag=0.0/1.0/1e+1500
                  maxiter=15000  }

Julia set :

test               {
  reset=2004 type=julia center-mag=0/0/0.6666667
  params=-0.49749687108886109/-0.0025041736227045075 float=y inside=0
  colors=@default.map
  }

To use it :

  • Save file to fractint main directory.
  • Run fractint.
  • press 2 key
  • press F6 key
  • select par file ( default is usr/share/xfractint/pars/fractint.par )

One can :

  • save command to par file with b key
  • change from corners to center with F7 key
  • select par file with F6 key
  • load par file with ctrl-@

Reset causes Fractint to reset all calculation related parameters to their default values. Non-calculation parameters such as "printer=", "sound=", and "savename=" are not affected.[11] The reset=1730 in the parameter file shows that it was created with 17.3 version of Fractint.[12]

Search the code :

grep -R "par file"

result :

 miscres.c:   /* just to make par file look nicer */
 miscovl.c:               ranges which can be written as <nn> to compress .par file entry.
 printer.c:            /* user might change gammas with a .par file entry mid-run.     */

decomposition[edit]

Aproximation of field lines on the parameter plane ( exterioar of Mandelbrot set) by 256-decomposition[13]

Field              { ; Field lines, Jay R Hill, 1997
  reset=1960 type=mandel center-mag=-0.75/-1.12577e-013/0.8695652
  params=0/0 float=y maxiter=256 bailout=3600 decomp=256
  colors=000www<33>www000www<33>www000w\
  ww<9>www000www<23>www000www<32>www0\
  00www<22>www000www<9>www000www<34>\
  www000www<32>www000000
  savename=field
  }

See also:

Lists[edit]

code[edit]

algorithms[edit]

Escher like tilings of Julia sets[edit]

In Version 19.6 new features include: new fractal types {=HT_ESCHER escher_julia} and {=HT_VL volterra-lotka} courtesy Michael Sargent.

Escher-Like Julia Sets

(type=escher_julia)

These unique variations on the Julia set theme, presented in The Science of Fractal Images, challenge us to expand our pre-conceived notions of how fractals should be iterated. We start with a very basic Julia formula:

   z(n+1) = z(n)^2 + (0, 0i)

The standard algorithm would test each iterated point to see if it "escapes to infinity". If its size or "modulus" (its distance from the origin) exceeds a preselected Bailout Test (p. 100) value, it is outside the Julia set, and it is banished to the world of multicolored level sets which color-cycle spectacularly. But another way of describing an escaped point is to say that it is "attracted" to infinity. We make this decision by calculating whether the point falls within the "target set" of all points closer to infinity than the boundary created by the bailout value. In this way, the "disk around infinity" is conceptually no different from the disks around Finite Attractors (p. 188) such as those used for Newton fractals.

In the above formula, with c = (0, 0i), this standard algorithm yields a rather unexciting circle. But along comes Peitgen to tell us that "since T [the target set] can essentially be anything, this method has tremendous artistic potential. For example, T could be a so-called p- norm disk ... or a scaled filled-in Julia set or something designed by hand. This method opens a simple [beware when he uses words like that] and systematic approach to Escher-like tilings."

So, what we do is iterate the above formula, scale each iteration, and plug it into a second Julia formula. This formula has a value of c selected by the user. If the point converges to this non-circular target set:

   T = [ z: | (z * 15.0)^2 + c | < BAILOUT ]

we color it in proportion to the overall iteration count. If not, it will be attracted to infinity and can be colored with the usual outside coloring options. This formula uses a new Fractint programming feature which allows the use of a customized coloring option for the points which converge to the target Julia set, yet allows the other points to be handled by the standard fractal engine with all of its options.

With the proper palette and parameters for c, and using the Inversion (p. 94) option and a solid outside color from the Color Parameters p. 130), you can create a solar eclipse, with the corona composed of Julia-shaped flames radiating from the sun's surface.

If you question the relevance of these images to Escher, check out his Circle Limit series (especially III and IV). In his own words: "It is to be doubted whether there exist today many ... artists of any kind, to whom the desire has come to penetrate to the depths of infinity.... There is only one possible way of ... obtaining an "infinity" entirely enclosed within a logical boundary line.... The largest ... shapes are now found in the center and the limit of infinite number and infinite smallness is reached at the circumference.... Not one single component ever reaches the edge. For beyond that there is "absolute nothingness." And yet this round world cannot exist without the emptiness around it, not simply because "within" presupposes "without", but also because it is out there in the "nothingness" that the center points of the arcs that go to build up the framework are fixed with such geometric exactitude."

References:

  • Ernst, B. The Magic Mirror of M. C. Escher, Barnes & Noble, 1994, pp. 102-11.
  • Peitgen, H.-O. and Saupe, D. The Science of Fractal Images, Springer-Verlag, 1988; pp. 185, 187.


One can search the source code using:

 grep -nR "escher"

Results:

// help2.src
    Escher-like tiling of Julia sets from The Science of Fractal Images
      z(0) = pixel
      z(n+1) = z(n)^2 + (0, 0i)
    The target set is a second, scaled, Julia set:
      T = [ z: | (z * 15.0)^2 + c | < BAILOUT ]
    Two parameters: real and imaginary parts of c
    Iteration count and bailout size apply to both Julia sets.
// fractalp.c
   {
   "escher_julia",
      {realparm, imagparm, ES, ES},
      {0.32, 0.043, 0, 0},
      HT_ESCHER, HF_ESCHER, WINFRAC,
      (float)-1.6, (float)1.6, (float)-1.2, (float)1.2,
      0, NOFRACTAL, NOFRACTAL, NOFRACTAL, ORIGIN,
      EscherfpFractal, juliafp_per_pixel, StandardSetup, 
          StandardFractal,
      STDBAILOUT
   },


// fractal19.par
{ ; "Escher-Julia #1"                     t=  0:32:35.06
  ; t=calc time [h:mm:ss.] using 486DX2-66 at 1024x768
  ; (c) 1997 by Les St Clair 101461.2032@compuserve.com
  ; parameters created on Apr 13, 1997
  reset=1960 type=escher_julia passes=1
  center-mag=+0.42798355610118920/+0.29420988317529780/3.4153
  params=0.005/0.641 float=y bailout=100 inside=bof60 logmap=4
  decomp=256
  colors=000H51<39>ywezxfzxf<40>H51G40G40<40>ywezxfzxf<40>H51G40G40<40>ywe\
  zxfzxf<39>I62 cyclerange=0/255
  }

boundary trace[edit]

/*

fracint 

CALCFRAC.C contains the high level ("engine") code for calculating the
fractal images (well, SOMEBODY had to do it!).
Original author Tim Wegner, but just about ALL the authors have contributed
SOME code to this routine at one time or another, or contributed to one of
the many massive restructurings.
The following modules work very closely with CALCFRAC.C:
  FRACTALS.C    the fractal-specific code for escape-time fractals.
  FRACSUBR.C    assorted subroutines belonging mainly to calcfrac.
  CALCMAND.ASM  fast Mandelbrot/Julia integer implementation
Additional fractal-specific modules are also invoked from CALCFRAC:
  LORENZ.C      engine level and fractal specific code for attractors.
  JB.C          julibrot logic
  PARSER.C      formula fractals
  and more
 -------------------------------------------------------------------- */
 
 
/******************* boundary trace method ***************************
Fractint's original btm was written by David Guenther.  There were a few
rare circumstances in which the original btm would not trace or fill
correctly, even on Mandelbrot Sets.  The code below was adapted from
"Mandelbrot Sets by Wesley Loewer" (see calmanfp.asm) which was written
before I was introduced to Fractint.  It should be noted that without
David Guenther's implimentation of a btm, I doubt that I would have been
able to impliment my own code into Fractint.  There are several things in
the following code that are not original with me but came from David
Guenther's code.  I've noted these places with the initials DG.

                                        Wesley Loewer 3/8/92
*********************************************************************/



#define bkcolor 0  /* I have some ideas for the future with this. -Wes */
#define advance_match()     coming_from = ((going_to = (going_to - 1) & 0x03) - 1) & 0x03
#define advance_no_match()  going_to = (going_to + 1) & 0x03


/***** vars for new btm *****/
enum direction {North,East,South,West};
enum direction going_to;
int trail_row, trail_col;


static
int  bound_trace_main(void)
    {
    enum direction coming_from;
    unsigned int match_found, continue_loop;
    int trail_color, fillcolor_used, last_fillcolor_used = -1;
    int max_putline_length;
    int right, left, length;
    static FCODE btm_cantbeused[]={"Boundary tracing cannot be used with "};
    if (inside == 0 || outside == 0)
        {
        static FCODE inside_outside[] = {"inside=0 or outside=0"};
        char msg[MSGLEN];
        far_strcpy(msg,btm_cantbeused);
        far_strcat(msg,inside_outside);
        stopmsg(0,msg);
        return(-1);
        }
    if (colors < 16)
        {
        char msg[MSGLEN];
        static FCODE lessthansixteen[] = {"< 16 colors"};
        far_strcpy(msg,btm_cantbeused);
        far_strcat(msg,lessthansixteen);
        stopmsg(0,msg);
        return(-1);
        }

    got_status = 2;
    max_putline_length = 0; /* reset max_putline_length */
    for (currow = iystart; currow <= iystop; currow++)
        {
        reset_periodicity = 1; /* reset for a new row */
        color = bkcolor;
        for (curcol = ixstart; curcol <= ixstop; curcol++)
            {
            if (getcolor(curcol, currow) != bkcolor)
                continue;

            trail_color = color;
            row = currow;
            col = curcol;
            if ((*calctype)()== -1) /* color, row, col are global */
                {
                if (showdot != bkcolor) /* remove showdot pixel */
                   (*plot)(col,row,bkcolor);
                if (iystop != yystop)  /* DG */
                   iystop = yystop - (currow - yystart); /* allow for sym */
                add_worklist(xxstart,xxstop,curcol,currow,iystop,currow,0,worksym);
                return -1;
                }
            reset_periodicity = 0; /* normal periodicity checking */

            /*
            This next line may cause a few more pixels to be calculated,
            but at the savings of quite a bit of overhead
            */
            if (color != trail_color)  /* DG */
                continue;

            /* sweep clockwise to trace outline */
            trail_row = currow;
            trail_col = curcol;
            trail_color = color;
            fillcolor_used = fillcolor > 0 ? fillcolor : trail_color;
            coming_from = West;
            going_to = East;
            match_found = 0;
            continue_loop = TRUE;
            do
                {
                step_col_row();
                if (row >= currow
                        && col >= ixstart
                        && col <= ixstop
                        && row <= iystop)
                    {
                    /* the order of operations in this next line is critical */
                    if ((color = getcolor(col, row)) == bkcolor && (*calctype)()== -1)
                                /* color, row, col are global for (*calctype)() */
                        {
                        if (showdot != bkcolor) /* remove showdot pixel */
                           (*plot)(col,row,bkcolor);
                        if (iystop != yystop)  /* DG */
                           iystop = yystop - (currow - yystart); /* allow for sym */
                        add_worklist(xxstart,xxstop,curcol,currow,iystop,currow,0,worksym);
                        return -1;
                        }
                    else if (color == trail_color)
                        {
                        if (match_found < 4) /* to keep it from overflowing */
                                match_found++;
                        trail_row = row;
                        trail_col = col;
                        advance_match();
                        }
                    else
                        {
                        advance_no_match();
                        continue_loop = going_to != coming_from || match_found;
                        }
                    }
                else
                    {
                    advance_no_match();
                    continue_loop = going_to != coming_from || match_found;
                    }
                } while (continue_loop && (col != curcol || row != currow));

            if (match_found <= 3)  /* DG */
                { /* no hole */
                color = bkcolor;
                reset_periodicity = 1;
                continue;
                }

/*
Fill in region by looping around again, filling lines to the left
whenever going_to is South or West
*/
            trail_row = currow;
            trail_col = curcol;
            coming_from = West;
            going_to = East;
            do
                {
                match_found = FALSE;
                do
                    {
                    step_col_row();
                    if (row >= currow
                            && col >= ixstart
                            && col <= ixstop
                            && row <= iystop
                            && getcolor(col,row) == trail_color)
                              /* getcolor() must be last */
                        {
                        if (going_to == South
                                || (going_to == West && coming_from != East))
                            { /* fill a row, but only once */
                            right = col;
                            while (--right >= ixstart && (color = getcolor(right,row)) == trail_color)
                                ; /* do nothing */
                            if (color == bkcolor) /* check last color */
                                {
                                left = right;
                                while (getcolor(--left,row) == bkcolor)
                                      /* Should NOT be possible for left < ixstart */
                                    ; /* do nothing */
                                left++; /* one pixel too far */
                                if (right == left) /* only one hole */
                                    (*plot)(left,row,fillcolor_used);
                                else
                                    { /* fill the line to the left */
                                    length=right-left+1;
                                    if (fillcolor_used != last_fillcolor_used || length > max_putline_length)
                                        { /* only reset dstack if necessary */
                                        memset(dstack,fillcolor_used,length);
                                        last_fillcolor_used = fillcolor_used;
                                        max_putline_length = length;
                                        }
                                    sym_fill_line(row, left, right, dstack);
                                    }
                                } /* end of fill line */

#if 0 /* don't interupt with a check_key() during fill */
                            if(--kbdcount<=0)
                                {
                                if(check_key())
                                    {
                                    if (iystop != yystop)
                                       iystop = yystop - (currow - yystart); /* allow for sym */
                                    add_worklist(xxstart,xxstop,curcol,currow,iystop,currow,0,worksym);
                                    return(-1);
                                    }
                                kbdcount=max_kbdcount;
                                }
#endif
                            }
                        trail_row = row;
                        trail_col = col;
                        advance_match();
                        match_found = TRUE;
                        }
                    else
                        advance_no_match();
                    } while (!match_found && going_to != coming_from);

                if (!match_found)
                    { /* next one has to be a match */
                    step_col_row();
                    trail_row = row;
                    trail_col = col;
                    advance_match();
                    }
                } while (trail_col != curcol || trail_row != currow);
            reset_periodicity = 1; /* reset after a trace/fill */
            color = bkcolor;
            }
        }
    return 0;
    }

/*******************************************************************/
/* take one step in the direction of going_to */
static void step_col_row()
    {
    switch (going_to)
        {
        case North:
            col = trail_col;
            row = trail_row - 1;
            break;
        case East:
            col = trail_col + 1;
            row = trail_row;
            break;
        case South:
            col = trail_col;
            row = trail_row + 1;
            break;
        case West:
            col = trail_col - 1;
            row = trail_row;
            break;
        }
    }

/******************* end of boundary trace method *******************/

Install[edit]

Help[edit]

References[edit]

  1. fractint Image Calculation Parameters
  2. Fractaal forum : FractInt > Mag
  3. Converting between FractInt and Fractal eXtreme palettes
  4. the KAM map by Fred Schimmel
  5. A short Introducion to PAR Files by Laurent Chabin
  6. julian haight : filmer instructions
  7. Fractint doc index
  8. Fractint par files by Rupert Russell
  9. Video for FRACTINT by Chabin Laurent
  10. Fractint .par file page
  11. fractint Image Calculation Parameters
  12. [Fractint] FOTD 27-07-11 (Bad Moon on the Rise [No Rating])
  13. Rendering the Field Lines of the Mandelbrot Set by Richard A Thomson
  14. Fractint deep zoom
  15. Index of /spanky/pub/fractals/params
  16. nehee par collection
  17. fracton links