File:Coloured Voronoi 2D.png
维基共享资源,媒体文件资料库
跳转到导航
跳转到搜索
Coloured_Voronoi_2D.png (333 × 333像素,文件大小:23 KB,MIME类型:image/png)
文件信息
结构化数据
说明
本檔案是由Maksim從en.wikipedia轉移到維基共享資源。
原始描述頁面位於這裡。下列使用者名稱均來自en.wikipedia。
Coloured 2D Voronoi diagram, made by me.
已授权您依据自由软件基金会发行的无固定段落及封面封底文字(Invariant Sections, Front-Cover Texts, and Back-Cover Texts)的GNU自由文件许可协议1.2版或任意后续版本的条款,复制、传播和/或修改本文件。该协议的副本请见“GNU Free Documentation License”。http://www.gnu.org/copyleft/fdl.htmlGFDLGNU Free Documentation Licensetruetrue |
本文件采用知识共享署名-相同方式共享 3.0 未本地化版本许可协议授权。 | ||
| ||
本许可协议标签作为GFDL许可协议更新的组成部分被添加至本文件。http://creativecommons.org/licenses/by-sa/3.0/CC BY-SA 3.0Creative Commons Attribution-Share Alike 3.0truetrue |
File:coloured Voronoi 2D.svg是此文件的矢量版本。 如果此文件质量不低于原点阵图,就应该将这个PNG格式文件替换为此文件。
File:Coloured Voronoi 2D.png → File:coloured Voronoi 2D.svg
更多信息请参阅Help:SVG/zh。
|
本作品为自由软件,您可以依据自由软件基金会发行的GNU通用公共许可证第2版或任意后续版本的条款,传播和/或修改本作品。本作品发表时预期有用,但对此无任何保证,亦无隐含的可以销售或适合特定目的的保证。详情请见GNU通用公共许可证第2版和第3版。http://www.gnu.org/licenses/gpl.htmlGPLGNU General Public Licensetruetrue |
#include <stdio.h> #include <math.h> #include <stdlib.h> #include <time.h> #define PI 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825 #define PI2 (PI*2) #define SQ2 1.414213562373095048801688724209698078569671875376948073176679737990732478462 #define FI 1.618033988749894848204586834365638117720309179805762862135448622705260462818902449707207204 #define SX 666 #define SY 666 #define NPT 100 #define RSD 666 #define V3D 0 /* #define SX 666 #define SY 666 #define NPT 1000 #define RSD 1923879 #define V3D 1 */ #define BPL ((SX*3+3)&~3) void seedr(unsigned int); unsigned int rnd(); unsigned int rndm(unsigned int); unsigned char bhdr[54]={ 0x42, 0x4D, 0x36, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x12, 0x0B, 0x00, 0x00, 0x12, 0x0B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; unsigned char po[BPL]; double gr[SY][SX][3]; void drawit(); int main(int a, char **b) { FILE *o; int x, y, c; double t; unsigned char *p; srand(time(0)); drawit(); p=bhdr+2; *p++=x=54+BPL*SY; *p++=x>>=8; *p++=x>>=8; *p=x>>=8; p=bhdr+18; *p++=x=SX; *p++=x>>=8; *p++=x>>=8; *p++=x>>=8; *p++=x=SY; *p++=x>>=8; *p++=x>>=8; *p=x>>=8; if(!(o=fopen("voronoi.bmp", "wb"))) { fclose(o); printf("Couldn't open output file.\n"); return(0); } fwrite(bhdr, 54, 1, o); for(x=SX*3;x<BPL;++x) po[x]=0; for(y=SY-1;~y;--y) { for(x=0,p=po;x<SX;++x) for(c=2;~c;--c) *p++=(t=gr[y][x][c])<=0?0:(t>=1?255:t*255); fwrite(po, BPL, 1, o); } fclose(o); return(0); } int ptx[NPT], pty[NPT], ptz[NPT]; double ptc[NPT][3]; void drawit() { int x, y, c, n, bn, dx, dy, dz; unsigned int m, p; seedr(RSD); for(n=0;n<NPT;++n) { ptx[n]=rndm(SX); pty[n]=rndm(SX); ptz[n]=(!!V3D)*(rndm(SX)-SX/2); for(c=0;c<3;++c) ptc[n][c]=rnd()/(double)~0u; } for(y=0;y<SY;++y) for(x=0;x<SY;++x) { for(n=0,m=~0;n<NPT;++n) { dx=x-ptx[n]; dy=y-pty[n]; dz=-ptz[n]; p=dx*dx+dy*dy+dz*dz; if(p<m) { m=p; bn=n; } } for(c=0;c<3;++c) gr[y][x][c]=ptc[bn][c]; } if(!V3D) for(n=0;n<NPT;++n) for(y=-1+!pty[n];y<=1-(pty[n]==SY-1);++y) for(x=-1+!ptx[n];x<=1-(ptx[n]==SX-1);++x) for(c=0;c<3;++c) gr[pty[n]+y][ptx[n]+x][c]=0; } unsigned int rseeda[624]; int rseedu; void seedr(unsigned int s) { int n; rseedu=624; rseeda[0]=s; for(n=1;n<624;++n) rseeda[n]=s*=69069u; } #define TEMPBLAH(x,y,z) { v=(rseeda[x]&0x80000000)|(rseeda[y]&0x7fffffff);\ rseeda[x]=rseeda[z]^(v>>1)^(0x9908b0df&(0-(v&1)));} void gennewr() { int n; unsigned int v; for(n=0;n<227;++n) TEMPBLAH(n, n+1, n+397); for(;n<623;++n) TEMPBLAH(n, n+1, n-227); TEMPBLAH(623, 0, 396); rseedu=0; } #undef TEMPBLAH unsigned int rnd() { if(rseedu>=624) gennewr(); unsigned int v=rseeda[rseedu++]; v^=v>>11; v^=(v<<7)&0x9d2c5680; v^=(v<<15)&0xefc60000; v^=v>>18; return(v); } unsigned int rndm(unsigned int m) { unsigned int v, c=(0u-m)/m; while((v=rnd())/m>c); return(v%m); }
date/time | username | edit summary |
---|---|---|
18:11, 7 September 2005 | en:User:Ja seed | (+ja) |
12:04, 25 January 2005 | en:User:Voinic | (char *p -> unsigned char *p;) |
20:18, 14 October 2004 | en:User:Cyp | (+Image generator source code, made by me) |
20:16, 14 October 2004 | en:User:Cyp | (Coloured 2D Voronoi diagram, made by me. {{GFDL}}) |
原始上传日志
[编辑]Legend: (cur) = this is the current file, (del) = delete this old version, (rev) = revert to this old version.
Click on date to download the file or see the image uploaded on that date.
- (del) (cur) 20:16, 14 October 2004 . . en:User:Cyp Cyp ( en:User_talk:Cyp Talk) . . 333x333 (23852 bytes) (Coloured 2D Voronoi diagram, made by me. { { GFDL } })
文件历史
点击某个日期/时间查看对应时刻的文件。
日期/时间 | 缩略图 | 大小 | 用户 | 备注 | |
---|---|---|---|---|---|
当前 | 2006年3月20日 (一) 19:49 | 333 × 333(23 KB) | Maksim(留言 | 贡献) | La bildo estas kopiita de wikipedia:en. La originala priskribo estas: Coloured 2D Voronoi diagram, made by me. {{GFDL}} //{{GPL}}<pre> #include <stdio.h> #include <math.h> #include <stdlib.h> #include <time.h> #define PI 3.1415926535897932384626433832 |
您不可以覆盖此文件。
文件用途
没有页面使用本文件。
全域文件用途
以下其他wiki使用此文件:
- cs.wikipedia.org上的用途
- de.wikipedia.org上的用途
- en.wikipedia.org上的用途
- es.wikipedia.org上的用途
- fr.wikipedia.org上的用途
- Diagramme de Voronoï
- Discussion:Diagramme de Voronoï
- Fouille de données spatiales
- Wikipédia:Le saviez-vous ?/Archives/2014
- Utilisateur:GhosterBot/BacASable/testStat/TOP50
- Utilisateur:GhosterBot/BacASable/testStat bis/Visibilité des anecdotes
- Utilisateur:GhosterBot/BacASable/testStat bis/Visibilité des anecdotes (2014)
- Utilisateur:GhosterBot/BacASable/testStat b/Visibilité des anecdotes
- Utilisateur:GhosterBot/BacASable/testStat b/Visibilité des anecdotes (2014)
- Utilisateur:GhosterBot/BacASable/testStat/Visibilité des anecdotes (2014)
- Wikipédia:Statistiques des anecdotes de la page d'accueil/Visibilité des anecdotes (2014)
- Wikipédia:Statistiques des anecdotes de la page d'accueil/Visibilité des anecdotes (2014)/2014 12
- it.wikipedia.org上的用途
- pl.wikipedia.org上的用途
元数据
此文件含有额外信息,这些信息可能是创建或数字化该文件时使用的数码相机或扫描仪所添加的。如果文件已从其原始状态修改,某些详细信息可能无法完全反映修改后的文件。
PNG文件备注 | |
---|---|
水平分辨率 | 28.34 dpc |
垂直分辨率 | 28.34 dpc |