This is a file from the Wikimedia Commons

File:LCMJ rabbit.jpg

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

Original file(2,000 × 2,000 pixels, file size: 428 KB, MIME type: image/jpeg)

Summary

Description
English: Level Curves of Escape Time for Cx=-0.12256, Cy=0.74486;The Julia set boundary itself is not drawn: we see it as the locus of points where the boundaries of level curves are especially close to each other.
Source Own work
Author Adam majewski
Other versions

Compare with

See also :

  • Level curves of Mandelbrot set
  • Figure 39 on page 189 from book J Milnor: Dynamics in one complex variable ( 2006 , third edition) . Milnor's figure shows Level Curves of potential ( not Escape Time)
  • "Rabbit Ears" Julia set[1]

Long description

  • this is c console program, which creates pgp file ( 8-bit color = gray scale ) in program directory. Technic of creating ppm file is based on the code of Claudio Rocchini.
  • First dynamic 1D array for 8-bit color values is created.
  • Color of points is saved in array
  • array is saved to the file

To see the file use external application ( image viewer). File was converted from pgm to jpg.

Image is created by:

  • creating Level Sets of Escape time of Fatou set
  • edge detection of Level sets. Algorithm is based on paper by M. Romera et al[2]

C source code

It is a console C program ( one file) It can be compiled under :

  • windows ( gcc thru Dev-C++ )
  • linux and mac using gcc :
gcc main.c -lm

it creates a.out file. Then run it :

./a.out

It creates ppm file in program directory. Use file viewer to see it.

/* 
c console program
 
 comments : Adam Majewski 
 fraktal.republika.pl 
*/
/* 
c console program:
 1. draws Level curves of escape time  for Fc(z)=z*z +c
 
 
 -------------------------------         
2. technic of creating ppm file is  based on the code of Claudio Rocchini
http://en.wikipedia.org/wiki/Image:Color_complex_plot.jpg
create 8 bit color ( gray scale ) graphic file ,  portable pixmap file = PGM  (P5)
see http://en.wikipedia.org/wiki/Portable_pixmap
to see the file use external application ( graphic viewer)
---------------------------------
3. 
Algorithm of drawing level curves is based on paper :
Drawing the Mandelbrot set by the method of escape lines. M. Romera et al.
http://www.iec.csic.es/~miguel/Preprint3.ps
this is translations of  BASIC program of M. Romera)
 */
#include <stdio.h>
#include <math.h>
int main()
{
        const double Cx=-0.12256,Cy=0.74486;
        
       
         /* screen ( integer) coordinate */
       int iX,iY;
       const int iXmax = 10000, iXmin=0; 
       const int iYmax = 10000, iYmin=0;
       int iWidth=iXmax-iXmin+1,
       iHeight=iYmax-iYmin+1,
       /* number of bytes = number of pixels of image * number of bytes of color */
       iLength=iWidth*iHeight*1,/* 1 bytes of color  */
       index; /* of array */
       
       /* world ( double) coordinate = dynamic plane ( z-plane) */
      
       const double ZxMin=-2.5;
       const double ZxMax=2.5;
       const double ZyMin=-2.5;
       const double ZyMax=2.5;
       /* */
       double PixelWidth=(ZxMax-ZxMin)/iXmax;
       double PixelHeight=(ZyMax-ZyMin)/iYmax;
       /* color component ( R or G or B) is coded from 0 to 255 */
       /* it is 8 bit color RGB file */
       const int MaxColorComponentValue=255; 
       FILE * fp;
       char *filename="LCMJ_rabbit.pgm";
       char *comment="# Cx=-0.12256, Cy=0.74486; EscapeRadius=1000 IterationMax=200;";/* comment should start with # */
       
       /* Z=Zx+Zy*i  ;   Z0 = 0 */
       double Zx, Zy;
       double Zx2, Zy2; /* Zx2=Zx*Zx;  Zy2=Zy*Zy  */
       /*  */
       int Iteration, PreviousIter;
       const int IterationMax=200;
       /* bail-out value , radius of circle ;  */
       const double EscapeRadius=1000;
       double ER2=EscapeRadius*EscapeRadius;
       /* dynamic 1D array for 8-bit color values */    
       unsigned char *array;
       /*-------------------------------------------------------------------*/
       array = malloc( iLength * sizeof(unsigned char) );
       if (array == NULL)
       {
       fprintf(stderr,"Could not allocate memory");
       getchar();
       return 1;
       }
       else 
            {   fprintf(stderr,"I'm working. Please wait (:-))\n ");
                /* fill the data array with white points */       
            for(index=0;index<iLength-1;++index) array[index]=255;
            }
       /* ---------------------------------------------------------------*/
       
       
       
       
       /* first coat of paint */
       for(iY=0;iY<iYmax;iY++)
       {
            
            
            for(iX=0;iX<iXmax;iX++)
            {         /* compute Zx and Zy for each point */
                       Zy=ZyMin + iY*PixelHeight;
                       if (fabs(Zy)< PixelHeight/2) Zy=0.0; /*  */
                       Zx=ZxMin + iX*PixelWidth;
                       /* initial value of orbit  */
                       Zx2=Zx*Zx;
                       Zy2=Zy*Zy;
                       /* */
                       for (Iteration=0;Iteration<IterationMax && ((Zx2+Zy2)<ER2);Iteration++)
                       {
                           Zy=2*Zx*Zy + Cy;
                           Zx=Zx2-Zy2 +Cx;
                           Zx2=Zx*Zx;
                           Zy2=Zy*Zy;
                       };
                       /* plot point of Level Curve */
                       if (iX!=0 && Iteration!=PreviousIter)
                       { 
                          array[((iYmax-iY-1)*iXmax+iX)]=0;
                          PreviousIter=Iteration;                       
                       }
                 
                        
               }
       }
       
       /* second coat of paint */
       for(iX=0;iX<iXmax;iX++)
            {         
            
            for(iY=0;iY<iYmax;iY++)
              {/* compute Zx and Zy for each point */
               Zx=ZxMin + iX*PixelWidth;
               Zy=ZyMin + iY*PixelHeight;
               if (fabs(Zy)< PixelHeight/2) Zy=0.0; /*  */
            
            
                       /* initial value of orbit = Z */
                       Zx2=Zx*Zx;
                       Zy2=Zy*Zy;
                       /* */
                       for (Iteration=0;Iteration<IterationMax && ((Zx2+Zy2)<ER2);Iteration++)
                       {
                           Zy=2*Zx*Zy + Cy;
                           Zx=Zx2-Zy2 +Cx;
                           Zx2=Zx*Zx;
                           Zy2=Zy*Zy;
                       };
                       /* plot point of Level Curve */
                       if (iX!=0 && Iteration!=PreviousIter)
                       { 
                          array[((iYmax-iY-1)*iXmax+iX)]=0;
                          PreviousIter=Iteration;                       
                       }
                 
                        
               }
       }
       
       
       /* write the whole data array to ppm file in one step */      
     /*create new file,give it a name and open it in binary mode  */
     fp= fopen(filename,"wb"); /* b -  binary mode */
     if (fp == NULL){ fprintf(stderr,"file error"); }
           else
           {
           /*write ASCII header to the file*/
           fprintf(fp,"P5\n %s\n %d\n %d\n %d\n",comment,iXmax,iYmax,MaxColorComponentValue);
           /*write image data bytes to the file*/
           fwrite(array,iLength ,1,fp);
           fclose(fp);
           fprintf(stderr,"file saved\n");
           getchar();
           }
     free(array);
       
       getchar();
       return 0;
}

References

  1. Keenan Crane - Ray Tracing Quaternion Julia Sets on the GPU
  2. Drawing the Mandelbrot set by the method of escape lines. M. Romera et al.

Licensing

I, the copyright holder of this work, hereby publish it under the following licenses:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.
GNU head Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled GNU Free Documentation License.
You may select the license of your choice.

Captions

Add a one-line explanation of what this file represents

Items portrayed in this file

depicts

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current12:45, 4 June 2008Thumbnail for version as of 12:45, 4 June 20082,000 × 2,000 (428 KB)Soul windsurfer{{Information |Description= |Source= |Date= |Author= |Permission= |other_versions= }}
12:21, 4 June 2008Thumbnail for version as of 12:21, 4 June 200810,000 × 10,000 (3.99 MB)Soul windsurfer{{Information |Description=Level Curves of Escape Time for Cx=-0.12256, Cy=0.74486; |Source=Own work by uploader |Date= |Author=Adam majewski |Permission= |other_versions= }} {{ImageUpload|basic}}

Global file usage

The following other wikis use this file:

Metadata