Last modified on 21 December 2014, at 21:43

Fractals/Computer graphic techniques/2D/plane

Viewport = part of the planeEdit

A viewport is a polygon viewing region in computer graphics.[1]

TypesEdit

  • world coordinates ( with floating point valuese )
  • screen coordinates ( with integer values ) used for pixels of the screen or bitmap or array

Relation between these 2 types creates new items :

  • pixel size ( pixel spacing ) related with zoom
  • mapping ( converting) between screen and integer coordinates[2][3]
  • clipping
  • rasterisation

DescriptionEdit

Rectangle part of 2D plane can be described by :

  • corners ( 4 real numbers or 2 complex numbers = 2D points)
  • center and :
    • width ( 3 real numbers )
    • magnification ("If you use the center, you can change the zoom level and the plot zooms in/out smoothly on the same center point. " Duncan C)
    • radius

CornersEdit

Standard description in Fractint, Ultra Fractal, ChaosPro and Fractal Explorer are corners. For example initial plane for Mandelbrot set is

 Corners:                X                     Y
 Top-l          -2.5000000000000000    1.5000000000000000
 Bot-r           1.5000000000000000   -1.5000000000000000
 Ctr -0.5000000000000000   0.0000000000000000  Mag 6.66666667e-01
 X-Mag-Factor     1.0000   Rotation    0.000   Skew    0.000

Display window of parameter plane has :

  • a horizontal width of 4 (real)
  • a vertical width (height) of 3 (imag)
  • an aspect ratio (proportion) 4/3 ( also in pixels 640/480 so ther is no distorsion)
  • center z=-0.5

For julia set/ dynamic plane has :

Corners:                X                     Y
Top-l          -2.0000000000000000    1.5000000000000000
Bot-r           2.0000000000000000   -1.5000000000000000
Ctr  0.0000000000000000   0.0000000000000000  Mag 6.66666667e-01
X-Mag-Factor     1.0000   Rotation    0.000   Skew    0.000


Description from documentation of Fractint :


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.

Center and ...Edit

magnificationEdit

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.

Mag indicates the amount of magnification to use. Initial value ( no zoom ) is 6.66666667e-01.

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.

Skew tells how many degrees the image is leaning over. Positive angles will rotate and skew the image counter-clockwise.


Parameters can be saved to parmfile called fractint.par

widthEdit

Wolf Jung uses center and width:

/* 
   from mndlbrot.cpp  by Wolf Jung (C) 201
   These classes are part of Mandel 5.7, which is free software; you can
   redistribute and / or modify them under the terms of the GNU General
   Public License as published by the Free Software Foundation; either
   version 3, or (at your option) any later version. In short: there is
   no warranty of any kind; you must redistribute the source code as well
*/
void mndlbrot::startPlane(int sg, double &xmid, double &rewidth) const
{  if (sg > 0) 
     { xmid = -0.5; rewidth = 1.6; } // parameter plane
     else { xmid = 0; rewidth = 2.0; } // dynamic plane

radiusEdit

Claude Heiland-Allen[4] uses center and radius for parameter plane of complex quadratic polynomial:


view="-0.75 0 1.5" # standard view of parameter plane : center_re, center_im, radius


  // modified code using center and radius to scan the plane 
  int height = 720;
  int width = 1280;
  double dWidth;
  double dRadius = 1.5;
  double complex center= -0.75*I;
  double complex c;
  int i,j;
 
  double width2; // = width/2.0
  double height2; // = height/2.0
 
  width2 = width /2.0;
  height2 = height/2.0;
 
double complex coordinate(int i, int j, int width, int height, double complex center, double radius) 
{
  double x = (i - width2) / height2;
  double y = (j - height2) / height2;
  double complex c = center + radius * (x - I * y);
  return c;
}
 
for ( j = 0; j < height; ++j) {
    for ( i = 0; i < width; ++i) {
      c = coordinate(i, j, width, height, center, dRadius);
      // do smth 
       }
     }


or simply :


 
 double pixel_spacing = radius / (height / 2.0);
 complex double c = center + pixel_spacing * (x + I * y);

OrientationEdit

Check orientation of the plane by marking first quadrant of Cartesian plane :

if (x>0 && y>0) Color=MaxColor-Color;

It should be in upper right position.

OptimisationEdit

ScanningEdit

See :

  • Fractint Drawing Methods[7]
  • Fratal Witchcraft drawing methods by Steven Stoft[8]
  • AlmondBread algorithms [9]

All the pixelsEdit

Scan the plane :

  • all pixels ( plane is scaned pixel by pixel )
  • the same pixel size


Here in Lisp

; common lisp. Here float values can be used,  there is no mapping
(loop for y from -1.5 to 1.5 by 0.1 do
      (loop for x from -2.5 to 0.5 by 0.05 do
            (princ (code-char 42))) ; print char
      (format t "~%")) ; new line

and in C

/* c */
/* screen coordinate = coordinate of pixels */      
int iX, iY, 
iXmin=0, iXmax=1000,
iYmin=0, iYmax=1000,
iWidth=iXmax-iXmin+1,
iHeight=iYmax-iYmin+1;
 
/* world ( double) coordinate = parameter plane*/
const double ZxMin=-5;
const double ZxMax=5;
const double ZyMin=-5;
const double ZyMax=5;
 
/* */
double PixelWidth=(ZxMax-ZxMin)/iWidth;
double PixelHeight=(ZyMax-ZyMin)/iHeight;
double Zx, Zy,    /* Z=Zx+Zy*i   */
       Z0x, Z0y,  /* Z0 = Z0x + Z0y*i */
 
 for(iY=0;iY<iYmax;++iY)
      { Z0y=ZyMin + iY*PixelHeight; /* mapping from screen to world; reverse Y  axis */
        if (fabs(Z0y)<PixelHeight/2) Z0y=0.0; /* Zy = 0 is a special value  */    
        for(iX=0;iX<iXmax;++iX)
         {    /* initial value of orbit Z0 */
           Z0x=ZxMin + iX*PixelWidth;
          }
      }

Plane transformationsEdit

Mercator mapEdit

"the exponential map[10] (aka log polar or mercator projection)" [11]


" it is a log map toward the target point (or, as some might say, a Mercator projection with the target point as South pole and complex ∞ as North pole); horizontally it is periodic and I have placed two periods side to side, whereas vertically it extends to infinity at the top and at the bottom, which corresponds to zooming infinitely far out or in, at a factor of exp(2π)≈535.5 for every size of a horizontal period. Horizontal lines (“parallels”) on the log map correspond to concentric circles around the target point, and vertical lines to radii emanating from it; and the anamorphosis preserves angles." David Madore [12]

" The idea is to focus on a point in or near the Mandelbrot set, and create an image where one direction is the logarithm of the distance and the other one the angle. The result is very much like the astro-ph/031571 map[13] and theXKCD cartoon versions[14]. This map projection is conformal, so it does not distort local angles, and objects are usually recognizable on all scales." Anders Sandberg[15]

Exponential map by R Munafo [16]

ZoomEdit

Mandelbrot zoom created using Double-double precision


NotationEdit

If you want to zoom [17]

baseSize // constant value =  extend in real and imaginary axis when zoomLevel is zero.
zoomLevel // inital value = 0.0
zoomFactor = 2^(-zoomLevel) // initial value = 1.0 = no zoom
sizeX = zoomFactor * baseSize
sizeY = zoomFactor * baseSize   
minImaginary = centerY - sizeY/2
maxImaginary = centerY + sizeY/2

Note that base of zoom factor is important when one wants to optimize zooming by using previosly computed pixels.


Usually other notation is used :

baseSize // constant value =  extend in real and imaginary axis when zoomLevel is zero.
zoomLevel // inital value = 0.0
zoomFactor = 10^zoomLevel // initial value = 1.0 = no zoom
sizeX =  baseSize / zoomFactor
sizeY = baseSize / zoomFactor   
minImaginary = centerY - sizeY/2
maxImaginary = centerY + sizeY/2


" Some programs use a power of 2, others use scientific notation. " Dinkydau[18]

magnification = 2^(6901.591) = 3.8539742140068607747447368372813E2077 = 3.8539742140068607747447368372813 *10^(2077)

Pixel sizeEdit

Pixel size is size of a pixel in a world coordinate. For linear scale and same resolution on both axes :

iSize = iXmax - iXmin ; // width of image in pixels ( integer or screen ) coordinate ; pixels are numbered from iXmin to iXmax; image is rectangular
fSize = CxMax-CxMin // width of image in world ( floating point ) coordinate
PixelWidth = fWidth / iWidth
PixelSize = PixelWidth // 
Zoom exponent Zoom level [19] iSize fSize PixelSize Decimal digits Binary digits ( precision)
0 1 = 10^0 = 1.0e0 1000 3.0 0.003
1 10 = 10^1 =1.0e1 1000 0.3 0.0003
2 100 = 10^2 = 1.0e2 1000 0.03 0.00003 6
3 1000 = 10^3 = 1.0e3 1000 0.003 0.0000003 7
275 2.1*10^{275} = 2.1E275[20] 1000 1.42857142857143*10^{−275} 1.42857142857143*10^{−278} 278 945
2167 1E2167 [21]
n 10^n 10^3 3/10^n 3/10^{-n-3} n+3 3.4*(n+3)

See also pixel spacing

Maximal zoomEdit

Maximal zoom factor is :


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  }

Maximal zoom is correlated with :

  • precision ( single , double, Quadruple precision, multiple-precision (MP) )[25][26]
  • algorithm

Examples :

  • zoom factor for video [27]
  • zoom factor [28]

OptimisationEdit

PrecisionEdit

What precision do I need for zoom ?

  • log2(radius) = precision
  • it also depends on algorithm used to make an image


ExamplesEdit

Baby Monster by DinkydauSet[30] : zoom into parameter plane of complex quadratic polynomial :


program : mandel machine x one week ( 4000x3000 ) 
algorithm : escape time 
precision = 7000
magnification = 2^(6901.591) = 3.8539742140068607747447368372813E2077 = 3.8539742140068607747447368372813 *10^(2077)
centerRe =      0.4026223242141852148037824724584025835755135011342881027042525627039569502881670946745557412930327115393258794913548834454537746442641230778661250740808696667685167031459830818673342528174897920124209545137508922550549968221550363823064128549715028301461622593069839496780093952808237573205197164572673594064416772605893796305663235635527880132594672201779519565231079208219169990178251347386228988056919160862667394171741551928464324300754658056232719271701044207283382298845257395452425798232763791743779314353854383722879333193167946859425243707261854429090471722384741345982162350257163211439072535377347476863063971161548476045589432821456788895124531684440296396587503362225268140306547818930627963692042601813606866625158984034539104729252270036522838631376204929633117350514392534098621950298874921561848480721715466716034612641357006597673782157926191463771077735121499521415799630479650549024192802530771425233126786755033877940979179549256821540572419329726522803422394291516882903607750877675838298417678464016201757067174161515701977269714418733430534088597594663546370996913330820306039197466323342547246232849027813752870111841998012412400077840383443533115591420661427063968799614034835064533287768378088050419077884398682152379426978057892246066882890819414748458464211672718229513050617638747371353729091501912075437789263019440768014217748069621815249161576890441895414789868155359854876653884160567578413850597585526839599148529091786964892859271522516203113708568784835766360055829328924133199024188688844937378174198793904588311188393798698747503071556711010350663949412136302614381521786902283300674108990630100130448100638953468850976478379826240732566854132975350164428623726436941877225968956042433264823693750422381553726384657388053048021285450658976425595261910844568695172761539871359485880883688256972852102360571149799163601150837375544386512748326612079156006358192675222805435405708616040869538348696626733367203267216061599286266159729225868003852298996109238906739358339973449675179531666048724844664052031271387710787740075700568712301627930122446
centerIm = 0.3414661267010330639258781735300664742792277354243426548082347808924808079842063432641337745084491842274928006043526205335660078979452366866756969329129441667312564036874357179068281915055443525509599130331320610821012236201307641349065669509178006415633193858304674801753225345910395424302568889690765898697389344506716385444532416760848755811454604769082865518885687677043988923482755514450647501464529277548626228211775326421789838725360483456061933115401603120908257520719931828418717929225819541974242262149693721546436344398096633938554552017842417617179797586236724871081452420464280333125369667508863083941830427529275353658367633700463591140837752713130326658698539827580385561537043307893113743040288109423825683661313727523597674848484087312515923976610370831729746783850452751041682640731573001319728478688445020726240850018852640901126812894024112093280413500010748891409049642255971933031658182432137372842717466247939807168712399315317154441773203170047657667231871264210848409477591021867775954396341273647285869183323193925375356957738345603739082474205799801007250041854109282041356811030974599202640896266028843535401330225609771341865327032085135831902603640939226040984911910075236054433300263457714999659548633581618107640012502951867204419221851370812448359108387310012121047998792211175821507898822472067545566323088233165752919891462234618228444539224969139541397976528218516885487556195557179718372941445119064646137527396209369577296787387634243210140885928439211898265659865402840837723799792668419799443445421585714176943014398043568698898179253868782669987422851258992794036747294932260334459254264688360704250224826019403156200812024463700689508527620855762445523530566725311570637375162222843632726633580544365800704348649164263654725083759306974477081672768736376743801103735815276810809861222374937053298147754358060737309317498277835724639189151138998429279826787118135717747963875281826078928680133524179137446312206008103340479076493412664529374765456320670666843471865606806283972354009907403302001818229385746724505497627613149001435837120422584
iterationMax = 35 000 000


Cross Hair by Claude Heiland-Allen .[31] Below is the content of kfr file ( parameter for Kalles Fraktaler )[32]

Re: -1.94156695046089411519723545042405785041614289882129276726563682132425517088701591901639765783026799492137462058533435865811646793455507945
Im: -0.00017301617109765913618843129805085094212526763902256359889382674446838992551267030035919209576862092841923454016429306276671035659004195
Zoom: 3.15216049570E116
Iterations: 203416
IterDiv: 1.000000
SmoothMethod: 0
ColorMethod: 0
ColorOffset: 0
Rotate: 0.000000
Ratio: 360
Colors: 0,0,0,41,35,190,132,225,108,214,174,82,144,73,241,241,187,233,235,179,166,219,60,135,12,62,153,36,94,13,28,6,183,71,222,179,18,77,200,67,187,139,166,31,3,90,125,9,56,37,31,93,212,203,252,150,245,69,59,19,13,137,10,28,219,174,50,32,154,80,238,64,120,54,253,18,73,50,246,158,125,73,220,173,79,20,242,68,64,102,208,107,196,48,183,50,59,161,34,246,34,145,157,225,139,31,218,176,202,153,2,185,114,157,73,44,128,126,197,153,213,233,128,178,234,201,204,83,191,103,214,191,20,214,126,45,220,142,102,131,239,87,73,97,255,105,143,97,205,209,30,157,156,22,114,114,230,29,240,132,79,74,119,2,215,232,57,44,83,203,201,18,30,51,116,158,12,244,213,212,159,212,164,89,126,53,207,50,34,244,204,207,211,144,45,72,211,143,117,230,217,29,42,229,192,247,43,120,129,135,68,14,95,80,0,212,97,141,190,123,5,21,7,59,51,130,31,24,112,146,218,100,84,206,177,133,62,105,21,248,70,106,4,150,115,14,217,22,47,103,104,212,247,74,74,208,87,104,118,250,22,187,17,173,174,36,136,121,254,82,219,37,67,229,60,244,69,211,216,40,206,11,245,197,96,89,61,151,39,138,89,118,45,208,194,201,205,104,212,73,106,121,37,8,97,64,20,177,59,106,165,17,40,193,140,214,169,11,135,151,140,47,241,21,29,154,149,193,155,225,192,126,233,168,154,167,134,194,181,84,191,154,231,217,35,209,85,144,56,40,209,217,108,161,102,94,78,225,48,156,254,217,113,159,226,165,226,12,155,180,71,101,56,42,70,137,169,130,121,122,118,120,194,99,
Smooth: 1
MultiColor: 0
BlendMC: 0
MultiColors: 
Power: 2
FractalType: 0

Möbius transformationEdit

Riemann sphere

A Möbius transformation of the extended complex plane ( the Riemann sphere ) :

f\colon \hat{\mathbf{C}} \rightarrow \hat{\mathbf{C}}


is a rational function with general for :

 f(z) =\frac{az+b}{cz+d}

It's inverse function in general form is :

f^{-1}(w) = \frac{dw-b}{-cw+a}

Specifying a transformation by three pointsEdit

Given a set of three distinct points z1, z2, z3 on the one Riemann sphere ( let's call it z-sphere) and a second set of distinct points w1, w2, w3 on the second sphere ( w-sphere) , there exists precisely one Möbius transformation f(z) with :

  •  f(z_i) = w_i
  • f^{-1}(w) = z_i

for i=1,2,3

Mapping to 0, 1, infinityEdit

The Möbius transformation with an explicit formula :[33]

f(z)= \frac {(z-z_1)(z_2-z_3)}{(z-z_3)(z_2-z_1)}

maps :

  • z1 to w1= 0
  • z2 to w2= 1
  • z3 to w3= ∞
the unit circle to the real axis - first methodEdit

Let's choose 3 z points on a circle :

  • z1= -1
  • z2= i
  • z3= 1

then the Möbius transformation will be :

f(z)= \frac {(z+1)(i-1)}{(z-1)(i+1)}

Knowing that : [34]

i+1 = -i (i -1 )

one can simplify this to :

f(z)= i \frac {z+1}{z-1}

In Maxima CAS one can do it :

(%i1) rectform((z+1)*(%i-1)/((z-1)*(%i+1)));
(%o1) (%i*(z+1))/(z−1)

where coefficients of the general form are :

a = i
b = i
c = 1
d = -1

so inverse function can be computed using general form :

f^{-1}(w) = \frac{dw-b}{-cw+a} = \frac{-i - w}{i-w}

Lets check it using Maxima CAS :

(%i3) fi(w):=(-%i-w)/(%i-w);
(%o3) fi(w):=−%i−w/%i−w
(%i4) fi(0);
(%o4) −1
(%i5) fi(1);
(%o5) −%i−1/%i−1
(%i6) rectform(%);
(%o6) %i

Find how to compute it without symbolic computation program (CAS)  :

(%i3) fi(w):=(-%i-w)/(%i-w);
(%o3) fi(w):=−%i−w/%i−w
(%i8) z:x+y*%i;
(%o8) %i*y+x
(%i9) z1:fi(w);
(%o9) (−%i*y−x−%i)/(−%i*y−x+%i)
(%i10) realpart(z1);
(%o10) ((−y−1)*(1−y))/((1−y)^2+x^2)+x^2/((1−y)^2+x^2)
(%i11) imagpart(z1);
(%o11) (x*(1−y))/((1−y)^2+x^2)−(x*(−y−1))/((1−y)^2+x^2)
(%i13) ratsimp(realpart(z1));
(%o13) (y^2+x^2−1)/(y^2−2*y+x^2+1)
(%i14) ratsimp(imagpart(z1));
(%o14) (2*x)/(y^2−2*y+x^2+1)
2 steps of unrolling the main cardioid of Mandelbrot set: Moebius map and conformal map
Unrolled main cardioid of Mandelbrot set for periods 7-13

So using notation :

 z = x + yi = f^{-1}(w)

one gets :

 x = \operatorname{Re}(z) = \operatorname{Re}(f^{-1}(w))   = \frac{y^2+x^2-1}{y^2-2y+x^2+1}

y = \operatorname{Im}(z) = \operatorname{Im}(f^{-1}(w))  = \frac{2x}{y^2-2y+x^2+1}


It can be used for unrolling the Mandelbrot set components [35]

the unit circle to the real axis - second methodEdit

Function :

f(z) = i\frac{z-1}{z+1}

sends the unit circle to the real axis :

  • z=1 to w=0
  • z=i to w=1
  • z=-1 to w=\infty

Mapping to the imaginary axisEdit

Function f(z) = \frac{z-1}{z+1} sends the unit circle to the imaginary axis.[36]

ReferencesEdit

  1. viewport in wikipedia
  2. How to convert world to screen coordinates and vice versa
  3. | How to transform 2D world to screen coordinates OpenGL
  4. Claude Heiland-Allen blog
  5. michael hogg : fractalnet
  6. optimizing zoom animations by Claude Heiland-Allen
  7. Fractint Drawing Methods
  8. Synchronous-Orbit Algorithm by R Munafo
  9. The Almond BreadHomepage by Michael R. Ganss
  10. Exponential mapping with Kalles Fraktaler by Claude Heiland-Allen
  11. kf-extras for manipulating output from Kalles Fraktaler 2
  12. Mandelbrot set images and videos by David Madore
  13. [http://arxiv.org/abs/astro-ph/?0310571 A Map of the Universe by J. Richard Gott III, Mario Jurić, David Schlegel, Fiona Hoyle, Michael Vogeley, Max Tegmark, Neta Bahcall, Jon Brinkmann]
  14. xkcd : Depth
  15. Mercator Mandelbrot by Anders Sandberg
  16. Exponential map by R Munafo
  17. stackoverflow : how-do-i-zoom-into-the-mandelbrot-set
  18. Fractal Forum > Fractal Art > Images Showcase (Rate My Fractal) > Baby Monster
  19. zoom level definition
  20. Fractal Journey by ORSON WANG
  21. Zoom level discussion - Maximum zoom level supported by Fractal eXtreme
  22. video Mandelbrot Zoom 999 on youtube by phaumann
  23. zooming with exteded precision in Delphi
  24. DeepZooming with FractInt
  25. [:w:wiki/Talk:Floating_point/Archive_4#No_mention_of_Double-double No_mention_of_Double-double - talk]
  26. stackoverflow : mandelbrot-set-reaches-to-its-limit-way-too-soon
  27. fractalforums : problem with zooming transform one view rect-to another
  28. fractalforums "basic-location-and-zoom-question
  29. optimizing_zoom_animations by Claude Heiland-Allen
  30. Baby Monster by DinkydauSet
  31. Cross Hair by Claude Heiland-Allen
  32. Kalles Fraktaler 2 by Karl Runmo
  33. Triple transitivity by David J Wright 2004-12-04
  34. math.stackexchange questions : how-to-do-this-transformation-of-complex-rational-function
  35. Stretching cusps by Claude Heiland-Allen
  36. math.stackexchange questions: what-mobius-transformation-maps-the-unit-circle-z-z-1-to-the-real-axis/335061#335061