קובץ:JuliaModifiedDecomposition.png
תוכן הדף אינו נתמך בשפות אחרות.
מראה
מתוך ויקיפדיה, האנציקלופדיה החופשית
![קובץ:JuliaModifiedDecomposition.png](http://upload.wikimedia.org/wikipedia/commons/thumb/0/01/JuliaModifiedDecomposition.png/600px-JuliaModifiedDecomposition.png)
גודל התצוגה המקדימה הזאת: 600 × 600 פיקסלים. רזולוציות אחרות: 240 × 240 פיקסלים | 480 × 480 פיקסלים | 1,000 × 1,000 פיקסלים.
לקובץ המקורי (1,000 × 1,000 פיקסלים, גודל הקובץ: 121 ק"ב, סוג MIME: image/png)
![]() |
זהו קובץ שמקורו במיזם ויקישיתוף. תיאורו בדף תיאור הקובץ המקורי (בעברית) מוצג למטה. |
תקציר
תיאורJuliaModifiedDecomposition.png |
English: Modified binary decomposition of exterior of Julia set |
תאריך יצירה | |
מקור | נוצר על־ידי מעלה היצירה |
יוצר | Adam majewski |
C src code
/*
c console program
1. draws Julia setfor Fc(z)=z*z +c using :
colors exterior of Julia set using modified decomposition
dynamic 1D array for 24-bit color values
-------------------------------
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)
I think that manual creating graphic can't be simpler
-------------------------------------------------
Adam Majewski
fraktal.republika.pl
======================
Linux console :
save as n.c
to compile :
gcc -lm n.c
to run :
./a.out
It creates ppm file.
To see it use image viewer
To convert use Image Magic command line tools :
convert j.ppm -resize 1000x1000 j.png
Source code was formatted with emacs
*/
#include <stdio.h>
#include <stdlib.h> /* for ISO C Random Number Functions */
#include <math.h>
int main()
{ const double Cx=0.0,Cy=0.0;
/* screen coordinate = coordinate of pixels */
int iX, iY,
iXmin=0, iXmax=10000,
iYmin=0, iYmax=10000,
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=12; */
/* 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 */
Zx2,Zy2;
/* */
int Iteration,
IterationMax=600 , /*for loop */
iTemp;
/* bail-out value , radius of circle ; */
const int EscapeRadius=100;
/* PPM file */
FILE * fp;
char *filename="m.ppm";
char *comment="# this is julia set for c= 0";/* 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;
/*-------------------------------------------------------------------*/
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;
/*----------- main loop without checking of abs(zn) -------------*/
Zx=Z0x;
Zy=Z0y;
Zx2=Zx*Zx;
Zy2=Zy*Zy;
Iteration=0;
while (Iteration<IterationMax && (fabs(Zy)<EscapeRadius) )
{
Zy=2*Zx*Zy + Cy;
Zx=Zx2-Zy2 +Cx;
Zx2=Zx*Zx;
Zy2=Zy*Zy;
Iteration+=1;
}
/* --------------- compute pixel color (24 bit = 3 bajts) */
iTemp=((iYmax-iY-1)*iXmax+iX)*3;
/* interior of Filled-in Julia set = green */
if (Iteration==IterationMax)
{
array[iTemp]=0; /* Red*/
array[iTemp+1]=255; /* Green */
array[iTemp+2]=0;/* Blue */
}
else
/* exterior of Filled-in Julia set */
if (Zy>0 )
{
array[iTemp]=255; /* Red*/
array[iTemp+1]=255; /* Green */
array[iTemp+2]=255;/* Blue */
}
else
{
array[iTemp]=0; /* Red*/
array[iTemp+1]=0; /* Green */
array[iTemp+2]=0;/* Blue */
};
/*----------------- check the orientation of Z-plane by marking 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 %s saved\n",filename);
getchar();
}
free(array);
return 0;
} /* if (array .. else ... */
}
רישיון
אני, בעל זכויות היוצרים על עבודה זו, מפרסם בזאת את העבודה תחת הרישיון הבא:
![w:he:Creative Commons](https://upload.wikimedia.org/wikipedia/commons/thumb/7/79/CC_some_rights_reserved.svg/90px-CC_some_rights_reserved.svg.png)
![ייחוס](https://upload.wikimedia.org/wikipedia/commons/thumb/1/11/Cc-by_new_white.svg/24px-Cc-by_new_white.svg.png)
![שיתוף זהה](https://upload.wikimedia.org/wikipedia/commons/thumb/d/df/Cc-sa_white.svg/24px-Cc-sa_white.svg.png)
הקובץ הזה מתפרסם לפי תנאי רישיון קריאייטיב קומונז ייחוס-שיתוף זהה 3.0 לא מותאם.
- הנכם רשאים:
- לשתף – להעתיק, להפיץ ולהעביר את העבודה
- לערבב בין עבודות – להתאים את העבודה
- תחת התנאים הבאים:
- ייחוס – יש לתת ייחוס הולם, לתת קישור לרישיון, ולציין אם נעשו שינויים. אפשר לעשות את זה בכל צורה סבירה, אבל לא בשום צורה שמשתמע ממנה שמעניק הרישיון תומך בך או בשימוש שלך.
- שיתוף זהה – אם תיצרו רמיקס, תשנו, או תבנו על החומר, חובה עליכם להפיץ את התרומות שלך לפי תנאי רישיון זהה או תואם למקור.
כיתובים
נא להוסיף משפט שמסביר מה הקובץ מייצג
פריטים שמוצגים בקובץ הזה
מוצג
ערך כלשהו ללא פריט ויקינתונים
11 ביוני 2011
היסטוריית הקובץ
ניתן ללחוץ על תאריך/שעה כדי לראות את הקובץ כפי שנראה באותו זמן.
תאריך/שעה | תמונה ממוזערת | ממדים | משתמש | הערה | |
---|---|---|---|---|---|
נוכחית | 11:01, 11 ביוני 2011 | ![]() | 1,000 × 1,000 (121 ק"ב) | Soul windsurfer |
שימוש בקובץ
אין בוויקיפדיה דפים המשתמשים בקובץ זה.
שימוש גלובלי בקובץ
אתרי הוויקי השונים הבאים משתמשים בקובץ זה:
- שימוש באתר en.wikibooks.org