לדלג לתוכן

קובץ:Dynamical plane with Julia set for c=0.35 with binary decomposition.png

תוכן הדף אינו נתמך בשפות אחרות.
מתוך ויקיפדיה, האנציקלופדיה החופשית

לקובץ המקורי(2,000 × 2,000 פיקסלים, גודל הקובץ: 233 ק"ב, סוג MIME‏: image/png)

ויקישיתוף זהו קובץ שמקורו במיזם ויקישיתוף. תיאורו בדף תיאור הקובץ המקורי (בעברית) מוצג למטה.

תקציר

תיאור
English: Dynamical plane of discrete dynamical system based on the complex quadratic polynomial where c=0.35. Algorithm : discrete escape time with binary decomposition of target set [1]. Thx to Ingvar Kullberg [2]
תאריך יצירה
מקור נוצר על־ידי מעלה היצירה
יוצר Adam majewski
גרסאות אחרות

רישיון

אני, בעל זכויות היוצרים על עבודה זו, מפרסם בזאת את העבודה תחת הרישיון הבא:
w:he:Creative Commons
ייחוס שיתוף זהה
הקובץ הזה מתפרסם לפי תנאי רישיון קריאייטיב קומונז ייחוס-שיתוף זהה 4.0 בין־לאומי.
הנכם רשאים:
  • לשתף – להעתיק, להפיץ ולהעביר את העבודה
  • לערבב בין עבודות – להתאים את העבודה
תחת התנאים הבאים:
  • ייחוס – יש לתת ייחוס הולם, לתת קישור לרישיון, ולציין אם נעשו שינויים. אפשר לעשות את זה בכל צורה סבירה, אבל לא בשום צורה שמשתמע ממנה שמעניק הרישיון תומך בך או בשימוש שלך.
  • שיתוף זהה – אם תיצרו רמיקס, תשנו, או תבנו על החומר, חובה עליכם להפיץ את התרומות שלך לפי תנאי רישיון זהה או תואם למקור.

C src code

Old code ( without complex type and functions ) is below. New code is here


/* 
 c program:
  1. draws Fatou set for Fc(z)=z*z 
  using  binary decomposition
 -------------------------------         
 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 24 bit color graphic file ,  portable pixmap file = PPM 
 see http://en.wikipedia.org/wiki/Portable_pixmap
 to see the file use external application ( graphic viewer)
 ---------------------------------
 */
 #include <stdio.h>
 #include <stdlib.h> /* for ISO C Random Number Functions */
 #include <math.h>
 /*  gives sign of number */
 double sign(double d)
 {
       if (d<0)
       {return -1.0;}
       else {return 1.0;};
 };
 /* ----------------------*/
 int main()
 {   
    const double Cx=0.35,Cy=0.0; // Thx to Ingvar Kullberg http://klippan.seths.se/fractals/articles/3.pdf
     /* screen coordinate = coordinate of pixels */      
    int iX, iY, 
        iXmin=0, iXmax=20000,
        iYmin=0, iYmax=20000,
        iWidth=iXmax-iXmin+1,
        iHeight=iYmax-iYmin+1,
        /* 3D data : X , Y, color */
        /* number of bytes = number of pixels of image * number of bytes of color */
        iLength=iWidth*iHeight*3,/* 3 bytes of color  */
        index; /* of array */
   // int iXinc, iYinc,iIncMax=6;     
    /* world ( double) coordinate = parameter 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)/iWidth;
    double PixelHeight=(ZyMax-ZyMin)/iHeight;
    double Zx, Zy,    /* Z=Zx+Zy*i   */
           Z0x, Z0y,  /* Z0 = Z0x + Z0y*i */
           Zx2, Zy2, /* Zx2=Zx*Zx;  Zy2=Zy*Zy  */
           //NewZx, NewZy,
           DeltaX, DeltaY,
           SqrtDeltaX, SqrtDeltaY,
           AlphaX, AlphaY,
           BetaX,BetaY, /* repelling fixed point Beta */
           AbsLambdaA,AbsLambdaB;
          /*  */
        int Iteration,
            IterationMax=40000000,
            iTemp;
     /* bail-out value , radius of circle ;  */
    const int EscapeRadius=40;
    int ER2=EscapeRadius*EscapeRadius;
    double AR=PixelWidth, /* minimal distance from attractor = Attractor Radius */
           AR2=AR*AR,
           d,dX,dY; /*  distance from attractor : d=sqrt(dx*dx+dy*dy) */
        /* PPM file */
    FILE * fp;
    char *filename="40c.ppm";
    char *comment="# this is julia set for c= ";/* comment should start with # */
    const int MaxColorComponentValue=255;/* color component ( R or G or B) is coded from 0 to 255 */
    /* dynamic 1D array for 24-bit color values */    
    unsigned char *array;
    /*  ---------  find repelling fixed point ---------------------------------*/
   /* Delta=1-4*c */
   DeltaX=1-4*Cx;
   DeltaY=-4*Cy;
   /* SqrtDelta = sqrt(Delta) */
   /* sqrt of complex number algorithm from Peitgen, Jurgens, Saupe: Fractals for the classroom */
   if (DeltaX>0)
   {
    SqrtDeltaX=sqrt((DeltaX+sqrt(DeltaX*DeltaX+DeltaY*DeltaY))/2);
    SqrtDeltaY=DeltaY/(2*SqrtDeltaX);        
    }
    else /* DeltaX <= 0 */
    {
         if (DeltaX<0)
         {
          SqrtDeltaY=sign(DeltaY)*sqrt((-DeltaX+sqrt(DeltaX*DeltaX+DeltaY*DeltaY))/2);
          SqrtDeltaX=DeltaY/(2*SqrtDeltaY);        
          }
          else /* DeltaX=0 */
          {
           SqrtDeltaX=sqrt(fabs(DeltaY)/2);
           if (SqrtDeltaX>0) SqrtDeltaY=DeltaY/(2*SqrtDeltaX);
                        else SqrtDeltaY=0;    
                   }
    };
   /* Beta=(1-sqrt(delta))/2 */
   BetaX=0.5+SqrtDeltaX/2;
   BetaY=SqrtDeltaY/2;
   /* Alpha=(1+sqrt(delta))/2 */
   AlphaX=0.5-SqrtDeltaX/2;
   AlphaY=-SqrtDeltaY/2;
   AbsLambdaA=2*sqrt(AlphaX*AlphaX+AlphaY*AlphaY);
   AbsLambdaB=2*sqrt(BetaX*BetaX+BetaY*BetaY);
   printf(" Cx= %f\n",Cx);
   printf(" Cy= %f\n",Cy); 
   printf(" Beta= %f , %f\n",BetaX,BetaY);
   //printf(" BetaY= %f\n",BetaY);
   printf(" Alpha= %f, %f\n",AlphaX,AlphaY);
   //printf(" AlphaY= %f\n",AlphaY);
   printf(" abs(Lambda (Alpha))= %f\n",AbsLambdaA);
   printf(" abs(lambda(Beta))= %f\n",AbsLambdaB);
   /* initial value of orbit Z=Z0 is repelling fixed point */
   Zy=BetaY; /*  */
   Zx=BetaX; 
   /*-------------------------------------------------------------------*/
    array = malloc( iLength * sizeof(unsigned char) );
    if (array == NULL)
    {
      fprintf(stderr,"Could not allocate memory");
      getchar();
      return 1;
    }
    else 
    {         
      /* fill the data array with white points */       
      for(index=0;index<iLength-1;++index) array[index]=255;
      /* ---------------------------------------------------------------*/
      for(iY=0;iY<iYmax;++iY)
      {
          Z0y=ZyMin + iY*PixelHeight; /* reverse Y  axis */
             if (fabs(Z0y)<PixelHeight/2) Z0y=0.0; /*  */    
         for(iX=0;iX<iXmax;++iX)
         {    /* initial value of orbit Z0 */
             
              Z0x=ZxMin + iX*PixelWidth;
              /* Z = Z0 */
              Zx=Z0x;
              Zy=Z0y;
              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;
                    };
           iTemp=((iYmax-iY-1)*iXmax+iX)*3;        
           /* compute  pixel color (24 bit = 3 bytes) */
           if (Iteration==IterationMax)
                    { /*  interior of Filled-in Julia set  =  */
                          /* Z = Z0 */
                          Zx=Z0x;
                          Zy=Z0y;
                          Zx2=Zx*Zx;
                          Zy2=Zy*Zy;
                          dX=Zx-AlphaX;
                            dY=Zy-AlphaY;
                            d=dX*dX+dY*dY;
                         for (Iteration=0;Iteration<IterationMax && (d>AR2);Iteration++)
                        {
                            Zy=2*Zx*Zy + Cy;
                            Zx=Zx2-Zy2 +Cx;
                            Zx2=Zx*Zx;
                            Zy2=Zy*Zy;
                            dX=Zx-AlphaX;
                            dY=Zy-AlphaY;
                            d=dX*dX+dY*dY;
                        };
                         /* */
                           if (Zy>AlphaY) 
                           { 
                             array[iTemp]=0; /* Red*/
                             array[iTemp+1]=0;  /* Green */ 
                             array[iTemp+2]=0;/* Blue */
                           }
                           else 
                           {
                             array[iTemp]=255; /* Red*/
                             array[iTemp+1]=255;  /* Green */ 
                             array[iTemp+2]=255;/* Blue */    
                           };                      
                        }
               else 
                 /* exterior of Filled-in Julia set  */
              /*  */
                       if (Zy>0) 
                       { 
                         array[iTemp]=0; /* Red*/
                         array[iTemp+1]=0;  /* Green */ 
                         array[iTemp+2]=0;/* Blue */
                       }
                       else 
                       {
                         array[iTemp]=255; /* Red*/
                         array[iTemp+1]=255;  /* Green */ 
                         array[iTemp+2]=255;/* Blue */    
                       };                      
   /* check the orientation of Z-plane */
               /* mark first quadrant of cartesian plane*/     
             //  if (Z0x>0 && Z0y>0) array[((iYmax-iY-1)*iXmax+iX)*3]=255-array[((iYmax-iY-1)*iXmax+iX)*3];  
     }
    } 
 
 /* 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,"P6\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");
            //getchar();
            }
    free(array);
    return 0;
    } /* if (array ..  else ... */
 }

Image magic source code

convert -resize 2000x2000 40c.ppm 40c.png

References

  1. wikibooks : Binary_decomposition of dynamic plane
  2. Binary decomposition, acupuncture points and secondary decorations by Ingvar Kullberg

כיתובים

נא להוסיף משפט שמסביר מה הקובץ מייצג

פריטים שמוצגים בקובץ הזה

מוצג

היסטוריית הקובץ

ניתן ללחוץ על תאריך/שעה כדי לראות את הקובץ כפי שנראה באותו זמן.

תאריך/שעהתמונה ממוזערתממדיםמשתמשהערה
נוכחית22:36, 15 באוגוסט 2014תמונה ממוזערת לגרסה מ־22:36, 15 באוגוסט 2014‪2,000 × 2,000‬ (233 ק"ב)Soul windsurferUser created page with UploadWizard

אין בוויקיפדיה דפים המשתמשים בקובץ זה.

שימוש גלובלי בקובץ

אתרי הוויקי השונים הבאים משתמשים בקובץ זה:

מטא־נתונים