לדלג לתוכן

קובץ:Worley.jpg

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

לקובץ המקורי(1,024 × 1,024 פיקסלים, גודל הקובץ: 40 ק"ב, סוג MIME‏: image/jpeg)

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

תקציר

תיאור
English: Worley noise: example of worley noise with euclidean distance function
תאריך יצירה
מקור נוצר על־ידי מעלה היצירה
יוצר Rocchini

רישיון

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

Source Code

Very very raw C source code:

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

void worley_noise() {
	const int S = 1024;		// image Size
	const int N  = 128;		// Number of points
	const int K  = 2;		// color value sKale
	static int x[N],y[N];		// points positions
	int i,j,k;

	for(i=0;i<N;++i){ x[i] = rand()%S; y[i] = rand()%S; }

	FILE * fo = fopen("c:\\temp\\worley.pnm","wb");
	fprintf(fo,"P5\n#Created by Shqn\n%d %d\n255\n",S,S);

	for(j=0;j<S;++j) for(i=0;i<S;++i){		// for each pixel...
		int mind = S;
		for(k=0;k<N;++k) {					// compute min distance
			int dx = i-x[k];
			int dy = j-y[k];
			int d = (int)sqrt((double)(dx*dx+dy*dy));
			if(mind>d) mind = d;
		}
		
		mind *= K;							// scale and clip
		unsigned char b = mind<255 ? mind : 255;
		fwrite(&b,1,1,fo);
	}
	fclose(fo);
}


New code : c program

// Worley noise: example of worley noise with euclidean distance function by Rocchini

#include <stdio.h>
#include <stdlib.h> // rand
#include <time.h>
#include <math.h>

int main() {
	const int S = 1024;		// image Size
	const int N  = 128;		// Number of points
	const int K  = 2;		// color value sKale
	int x[N],y[N];		// points positions
	int i,j,k;
	
	
	srand(time(NULL));   // Initialization, should only be called once.
	for(i=0;i<N;++i){ x[i] = rand()%S; y[i] = rand()%S; }

	FILE * fo = fopen("worley.pnm","wb");
	fprintf(fo,"P5\n %d %d\n255\n",S,S);

	for(j=0;j<S;++j) 
		for(i=0;i<S;++i){		// for each pixel...
			int mind = S;
			for(k=0;k<N;++k) {					// compute min distance
				int dx = i-x[k];
				int dy = j-y[k];
				int d = (int)sqrt((double)(dx*dx+dy*dy));
				if(mind>d) mind = d;
			}
		
		mind *= K;							// scale and clip
		unsigned char b = mind<255 ? mind : 255;
		fwrite(&b,1,1,fo);
	}
	fclose(fo);
	
	return 0;
}

Using libvips library:

 vips vipsworley w.png  1000 1000

כיתובים

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

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

מוצג

image/jpeg

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

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

תאריך/שעהתמונה ממוזערתממדיםמשתמשהערה
נוכחית09:51, 5 באפריל 2012תמונה ממוזערת לגרסה מ־09:51, 5 באפריל 2012‪1,024 × 1,024‬ (40 ק"ב)Rocchini

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

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

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