File:GreatStellatedDodecahedron.jpg
页面内容不支持其他语言。
外观
本预览的尺寸:644 × 599像素。 其他分辨率:258 × 240像素 | 516 × 480像素 | 853 × 794像素。
原始文件 (853 × 794像素,文件大小:231 KB,MIME类型:image/jpeg)
摘要
描述GreatStellatedDodecahedron.jpg |
English: Great stellated dodecahedron, rendered with POVRay 本图片使用POV-Ray创作. |
来源 | 自己的作品 |
作者 | User Cyp |
这个file中的所有图片名上传在JPEG格式,即使它包含非照片数据。该信息可以以PNG或SVG格式更有效或更准确地存储。如果可能,请上传此图像的PNG或SVG版本,没有压缩失真,源自非JPEG源(或去除现存的失真)。完成后,请使用{{Superseded|NewImage.ext}} 标记JPEG版本并删除此标记。此标签不应应用于照片或扫描件。如需更多信息,请参阅{{BadJPEG}}。 |
许可协议
我,本作品著作权人,特此采用以下许可协议发表本作品:
已授权您依据自由软件基金会发行的无固定段落及封面封底文字(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 |
- 您可以自由地:
- 共享 – 复制、发行并传播本作品
- 修改 – 改编作品
- 惟须遵守下列条件:
- 署名 – 您必须对作品进行署名,提供授权条款的链接,并说明是否对原始内容进行了更改。您可以用任何合理的方式来署名,但不得以任何方式表明许可人认可您或您的使用。
- 相同方式共享 – 如果您再混合、转换或者基于本作品进行创作,您必须以与原先许可协议相同或相兼容的许可协议分发您贡献的作品。
您可以选择您需要的许可协议。
Source
//GPL #include <stdio.h> #include <math.h> #include <vector> using std::vector; const char *theader = "//Picture *** Use flashiness=1 !!! ***\n//\n// +w1024 +h1024 +a0.3 +am2\n// +w512 +h512 +a0.3 +am2\n//\n//Movie *** Use flashiness=0.25 !!! ***\n//\n// +kc +kff120 +w256 +h256 +a0.3 +am2\n// +kc +kff60 +w256 +h256 +a0.3 +am2\n//\"Fast\" preview\n// +w128 +h128\n#declare notwireframe=1;\n#declare withreflection=0;\n#declare flashiness=1; //Still pictures use 1, animated should probably be about 0.25.\n\n#declare rotation=seed(%d);\n\n#declare rot1=rand(rotation)*pi*2;\n#declare rot2=acos(1-2*rand(rotation));\n#declare rot3=(rand(rotation)+clock)*pi*2;\n#macro dorot()\n rotate rot1*180/pi*y\n rotate rot2*180/pi*x\n rotate rot3*180/pi*y\n#end\n\n"; const char *tline = "object {\n cylinder { <%lf,%lf,%lf>, <%lf,%lf,%lf>, .01 dorot() }\n pigment { colour <.3,.3,.3> }\n finish { ambient 0 diffuse 1 phong 1 }\n}\n\n"; const char *tvertex = "object {\n sphere { <%lf,%lf,%lf>, .01 dorot() }\n pigment { colour <.3,.3,.3> }\n finish { ambient 0 diffuse 1 phong 1 }\n}\n\n"; const char *tstartmesh = "object {\n mesh {\n"; const char *ttriangle = " triangle {\n <%lf,%lf,%lf>, <%lf,%lf,%lf>, <%lf,%lf,%lf>\n }\n"; const char *tendmesh = " //sphere { <0,0,0>, 1 }\n //sphere { <0,0,0>, ld+.01 inverse }\n dorot()\n }\n pigment { colour rgbt <.8,.8,.8,.4> }\n finish { ambient 0 diffuse 1 phong flashiness #if(withreflection) reflection { .2 } #end }\n //interior { ior 1.5 }\n photons {\n target on\n refraction on\n reflection on\n collect on\n }\n}\n\n"; const char *tfooter = "// CCC Y Y PP\n// C Y Y P P\n// C Y PP\n// C Y P\n// CCC Y P\n\n#local a=0;\n#while(a<11.0001)\n light_source { <4*sin(a*pi*2/11), 5*cos(a*pi*6/11), -4*cos(a*pi*2/11)> colour (1+<sin(a*pi*2/11),sin(a*pi*2/11+pi*2/3),sin(a*pi*2/11+pi*4/3)>)*2/11 }\n #local a=a+1;\n#end\n\nbackground { color <1,1,1> }\n\ncamera {\n perspective\n location <0,0,0>\n direction <0,0,1>\n right x/2\n up y/2\n sky <0,1,0>\n location <0,0,-4.8>\n look_at <0,0,0>\n}\n\nglobal_settings {\n max_trace_level 40\n photons {\n count 200000\n autostop 0\n }\n}\n"; #define PHI ((1+sqrt(5))/2) #define PI (3.14159265358979323846264338327) #define SQ2 (sqrt(2)) #define SQ3 (sqrt(3)) bool eq(double a, double b) { return a+0.00001>=b&&b+0.00001>=a; } bool eqt(double a1, double a2, double a3, double b1, double b2, double b3) { //printf("Tri: {%lf, %lf, %lf}, {%lf, %lf, %lf}\n", a1, a2, a3, b1, b2, b3); return eq(a1, b1)? eq(a2, b2)? eq(a3, b3):eq(a2, b3)&&eq(a3, b2):eq(a1, b2)? eq(a2, b3)? eq(a3, b1):eq(a2, b1)&&eq(a3, b3):eq(a1, b3)&&(eq(a2, b1)? eq(a3, b2):eq(a2, b3)&&eq(a3, b2)); } class vec { public: double x, y, z; vec() : x(0), y(0), z(0) {} vec(double nx, double ny, double nz) : x(nx), y(ny), z(nz) {} vec operator + (vec o) { return vec(x+o.x, y+o.y, z+o.z); } vec operator - (vec o) { return vec(x-o.x, y-o.y, z-o.z); } double operator * (vec o) { return x*o.x+y*o.y+z*o.z; } vec operator * (double o) { return vec(x*o, y*o, z*o); } vec operator ^ (vec o) { return vec(y*o.z-z*o.y, z*o.x-x*o.z, x*o.y-y*o.x); } double norm() { return sqrt(x*x+y*y+z*z); } }; class vec2 { public: double x, y; vec2() {} vec2(double nx, double ny) : x(nx), y(ny) {} vec2 operator + (vec2 o) { return vec2(x+o.x, y+o.y); } vec2 operator - (vec2 o) { return vec2(x-o.x, y-o.y); } double operator * (vec2 o) { return x*o.x+y*o.y; } vec2 operator * (double o) { return vec2(x*o, y*o); } vec2 operator ~ () { return vec2(y, -x); } double norm() { return sqrt(x*x+y*y); } }; vector<vec> cyclicperm(vector<vec> v) { vector<vec> r; vector<vec>::iterator i; for(i = v.begin(); i!=v.end(); ++i) { r.push_back(*i); r.push_back(vec(i->y, i->z, i->x)); r.push_back(vec(i->z, i->x, i->y)); } return r; } vector<vec> altperm(vector<vec> v) { vector<vec> r; vector<vec>::iterator i; for(i = v.begin(); i!=v.end(); ++i) { r.push_back(*i); r.push_back(vec(i->x, i->z, i->y)); } return r; } vector<vec> signperm(vector<vec> v) { vector<vec> r; vector<vec>::iterator i; for( i = v.begin(); i!=v.end(); ++i ) { int j; for(j = 0; j<8; ++j) if(((j&1)||i->x)&&((j&2)||i->y)&&((j&4)||i->z)) r.push_back(vec(j&1? i->x:-i->x, j&2? i->y:-i->y, j&4? i->z:-i->z)); } return r; } vector<vec> mvvec(double x, double y, double z) { vector<vec> v; v.push_back(vec(x, y, z)); return v; } vector<vec> mvvec(vec q) { vector<vec> v; v.push_back(q); return v; } vector<vec> concat(const vector<vec> a, const vector<vec> b) { vector<vec> r; r = a; r.insert(r.end(), b.begin(), b.end()); return r; } void printvvec(FILE *f, vector<vec> v) { vector<vec>::iterator i; for(i = v.begin(); i!=v.end(); ++i) fprintf(f, tvertex, i->x, i->y, i->z); } void printvveclines(FILE *f, vector<vec> v, double len) { vector<vec>::iterator i, j; len *= len; for(i = v.begin(); i!=v.end(); ++i) for(j = i+1; j!=v.end(); ++j) if(eq((*i-*j)*(*i-*j), len)) fprintf(f, tline, i->x, i->y, i->z, j->x, j->y, j->z); } void printvveclines(FILE *f, vector<vec> v) { vector<vec>::iterator i; for(i = v.begin(); i!=v.end(); i += 2) fprintf(f, tline, i->x, i->y, i->z, (i+1)->x, (i+1)->y, (i+1)->z); } void printvvecdottedlines(FILE *f, vector<vec> v) { vector<vec>::iterator i; int n, m; double s; for(i = v.begin(); i!=v.end(); i += 2) // for(i = v.begin(); i!=v.begin()+12; i += 2) { s = (*i-*(i+1)).norm(); m = (int)(s/0.04+.5); s = 1./(double)m; for(n = 1; n<m; ++n) { vec c = *i+(*(i+1)-*i)*(s*n); fprintf(f, tvertex, c.x, c.y, c.z); } } } void printvvectriangles(FILE *f, vector<vec> v, double len1, double len2, double len3) { vector<vec>::iterator i, j, k; len1 *= len1; len2 *= len2; len3 *= len3; for(i = v.begin(); i!=v.end(); ++i) for(j = i+1; j!=v.end(); ++j) for(k = j+1; k!=v.end(); ++k) if(eqt((*i-*j)*(*i-*j), (*j-*k)*(*j-*k), (*k-*i)*(*k-*i), len1, len2, len3)) fprintf(f, ttriangle, i->x, i->y, i->z, j->x, j->y, j->z, k->x, k->y, k->z); } void printvvectriangles(FILE *f, vector<vec> v) { vector<vec>::iterator i; for(i = v.begin(); i!=v.end(); i += 3) //i = v.begin(); fprintf(f, ttriangle, i->x, i->y, i->z, (i+1)->x, (i+1)->y, (i+1)->z, (i+2)->x, (i+2)->y, (i+2)->z); /*i += 3; fprintf(f, ttriangle, i->x, i->y, i->z, (i+1)->x, (i+1)->y, (i+1)->z, (i+2)->x, (i+2)->y, (i+2)->z); i += 3; fprintf(f, ttriangle, i->x, i->y, i->z, (i+1)->x, (i+1)->y, (i+1)->z, (i+2)->x, (i+2)->y, (i+2)->z); i += 3; fprintf(f, ttriangle, i->x, i->y, i->z, (i+1)->x, (i+1)->y, (i+1)->z, (i+2)->x, (i+2)->y, (i+2)->z); i += 3; fprintf(f, ttriangle, i->x, i->y, i->z, (i+1)->x, (i+1)->y, (i+1)->z, (i+2)->x, (i+2)->y, (i+2)->z); i += 3; fprintf(f, ttriangle, i->x, i->y, i->z, (i+1)->x, (i+1)->y, (i+1)->z, (i+2)->x, (i+2)->y, (i+2)->z); */} void SmallStellatedDodecahedron() { vector<vec> v; v = cyclicperm(signperm(mvvec(vec(0, PHI, 1)*(1/sqrt(PHI+2))))); FILE *f; f = fopen("SmallStellatedDodecahedron.pov", "wb"); fprintf(f, theader, 22491); printvvec(f, v); printvveclines(f, v, 2*PHI*(1/sqrt(PHI+2))); fprintf(f, tstartmesh); v = concat(v, cyclicperm(signperm(mvvec(vec(0, 2-PHI, 1)*(1/sqrt(PHI+2)))))); v = concat(v, signperm(mvvec(vec(PHI-1, PHI-1, PHI-1)*(1/sqrt(PHI+2))))); printvvectriangles(f, v, (2*PHI-2)*(1/sqrt(PHI+2)), (2*PHI-2)*(1/sqrt(PHI+2)), (4-2*PHI)*(1/sqrt(PHI+2))); fprintf(f, tendmesh); fprintf(f, tfooter); fclose(f); } void GreatStellatedDodecahedron() { vector<vec> v; v = concat(signperm(mvvec(vec(1, 1, 1)*(1/SQ3))), cyclicperm(signperm(mvvec(vec(0, PHI, 1/PHI)*(1/SQ3))))); FILE *f; f = fopen("GreatStellatedDodecahedron.pov", "wb"); fprintf(f, theader, 7409);//7412); printvvec(f, v); printvveclines(f, v, 2*PHI*(1/SQ3)); fprintf(f, tstartmesh); v = concat(v, cyclicperm(signperm(mvvec(vec(0, 2-PHI, PHI-1)*(1/SQ3))))); printvvectriangles(f, v, (2*PHI-2)*(1/SQ3), (2*PHI-2)*(1/SQ3), (4-2*PHI)*(1/SQ3)); fprintf(f, tendmesh); fprintf(f, tfooter); fclose(f); } void GreatDodecahedron() { vector<vec> v; v = cyclicperm(signperm(mvvec(vec(0, PHI, 1)*(1/sqrt(PHI+2))))); FILE *f; f = fopen("GreatDodecahedron.pov", "wb"); fprintf(f, theader, 11404); printvveclines(f, v, 2*(1/sqrt(PHI+2))); v = concat(v, concat(signperm(mvvec(vec(PHI-1, PHI-1, PHI-1)*(1/sqrt(PHI+2)))), cyclicperm(signperm(mvvec(vec(0, 2-PHI, 1)*(1/sqrt(PHI+2))))))); printvvec(f, v); fprintf(f, tstartmesh); printvvectriangles(f, v, (2*PHI-2)*(1/sqrt(PHI+2)), (2*PHI-2)*(1/sqrt(PHI+2)), (2)*(1/sqrt(PHI+2))); fprintf(f, tendmesh); fprintf(f, tfooter); fclose(f); } vector<vec> IcosaParse(const char *vs) { vector<vec> v, p; v = cyclicperm(signperm(mvvec(vec(0, PHI, 1)))); vec av; vector<vec>::iterator i, j, k; int q; static const vec2 rats[9] = {vec2(1, 0), vec2(PHI-1, 2-PHI), vec2(2-PHI, PHI-1), vec2(0, 1), vec2(0, PHI-1), vec2(0, 2-PHI), vec2(0, 0), vec2(2-PHI, 0), vec2(PHI-1, 0)}; for(i = v.begin(); i!=v.end(); ++i) for(j = v.begin(); j!=v.end(); ++j) for(k = v.begin(); k!=v.end(); ++k) if(eqt((*i-*j).norm(), (*j-*k).norm(), (*k-*i).norm(), 2, 2, 2)&&(*i^*j)**k>0) { vec t3 = *i*PHI*PHI+*j*PHI*PHI-*k*PHI*PHI*PHI, t1 = *j*PHI*PHI+*k*PHI*PHI-*i*PHI*PHI*PHI, t2 = *k*PHI*PHI+*i*PHI*PHI-*j*PHI*PHI*PHI; for(q = 0; vs[q]; ) { if(vs[q]<48) break; if(vs[q+1]<48) { p = concat(p, mvvec(t3+(t1-t3)*rats[vs[q]-'0'].x+(t2-t3)*rats[vs[q]-'0'].y)); q += 2; continue; } if(vs[q+4]<48) { vec2 a = rats[vs[q]-'0'], b = rats[vs[q+1]-'0'], c = rats[vs[q+2]-'0'], d = rats[vs[q+3]-'0']; double idet = 1/((a-b).x*(d-c).y-(a-b).y*(d-c).x); //fprintf(stderr, "%lf, %lf %lf, %lf %lf\n", (a-b).x, (d-c).x, (a-b).y, (d-c).y, idet); vec2 e = vec2(vec2((d-c).y, (d-c).x*-1)*(d-b), vec2((a-b).y*-1, (a-b).x)*(d-b))*idet; vec2 r = (a-b)*e.x+b; //fprintf(stderr, "%lf, %lf %lf, %lf %lf\n", r.x, r.y, t1.x, t1.y, idet); //fprintf(stderr, "(a-b)={%lf, %lf}, x=%lf, b={%lf, %lf}, e={%lf, %lf}\n(c-d)={%lf, %lf}, y=%lf, d={%lf, %lf}, e={%lf, %lf}\n", //(a-b).x, (a-b).y, e.x, b.x, b.y, ((a-b)*e.x+b).x, ((a-b)*e.x+b).y, //(c-d).x, (c-d).y, e.y, d.x, d.y, ((c-d)*e.y+d).x, ((c-d)*e.y+d).y //); //fprintf(stderr, "%lf %lf\n", r.x, r.y); p = concat(p, mvvec(t3+(t1-t3)*r.x+(t2-t3)*r.y)); av = av+(t3+(t1-t3)*r.x+(t2-t3)*r.y); //p = concat(p, mvvec(vec())); q += 5; continue; } break; } } //printf("%lf %lf %lf\n", av.x, av.y, av.z); double r = 0; for(i = p.begin(); i!=p.end(); ++i) //i = p.begin(); if(r<i->norm()) r = i->norm(); for(i = p.begin(); i!=p.end(); ++i) *i = *i*(1/r); return p; } void StellatedIcosahedron(const char *fn, int rs, const char *vs, const char *ls, const char *dls, const char *ts) { vector<vec> v; FILE *f; f = fopen(fn, "wb"); fprintf(f, theader, rs); printvvec(f, IcosaParse(vs)); printvvecdottedlines(f, IcosaParse(dls)); printvveclines(f, IcosaParse(ls)); fprintf(f, tstartmesh); printvvectriangles(f, IcosaParse(ts)); fprintf(f, tendmesh); fprintf(f, tfooter); fclose(f); } int main() { SmallStellatedDodecahedron(); GreatStellatedDodecahedron(); GreatDodecahedron(); StellatedIcosahedron("GreatIcosahedron.pov", 31234, "0 1 2 0417 1428 2538 ", "0 3 ", "0 0417 0417 1 1 1428 1428 2 2 2538 2538 3 ", "0 1 0417 1 2 1428 2 3 2538 "); StellatedIcosahedron("CompoundOfFiveTetrahedra.pov", 22113, "2 2514 1427 2715 1528 ", "2 5 ", "2 2 2514 1427 1427 2715 2715 1528 ", "2 2514 1427 2 2715 1528 "); return 0; }
此文件中描述的项目
描绘内容
文件历史
点击某个日期/时间查看对应时刻的文件。
日期/时间 | 缩略图 | 大小 | 用户 | 备注 | |
---|---|---|---|---|---|
当前 | 2005年12月19日 (一) 20:15 | 853 × 794(231 KB) | Cyp | Replacing missing pixels - cropped too small by one pixel on each edge. | |
2005年12月17日 (六) 20:30 | 851 × 792(231 KB) | Cyp | Great stellated dodecahedron, rendered with POVRay |
文件用途
全域文件用途
以下其他wiki使用此文件:
- as.wikipedia.org上的用途
- bn.wikipedia.org上的用途
- ca.wikipedia.org上的用途
- cy.wikipedia.org上的用途
- el.wikipedia.org上的用途
- en.wikipedia.org上的用途
- eo.wikipedia.org上的用途
- es.wikipedia.org上的用途
- eu.wikipedia.org上的用途
- fi.wikipedia.org上的用途
- fr.wikipedia.org上的用途
- id.wikipedia.org上的用途
- it.wikipedia.org上的用途
- ja.wikipedia.org上的用途
- ko.wikipedia.org上的用途
- no.wikipedia.org上的用途
- pt.wikipedia.org上的用途
- ro.wikipedia.org上的用途
- ru.wikipedia.org上的用途
- sl.wikipedia.org上的用途
查看此文件的更多全域用途。
元数据
此文件含有额外信息,这些信息可能是创建或数字化该文件时使用的数码相机或扫描仪所添加的。如果文件已从其原始状态修改,某些详细信息可能无法完全反映修改后的文件。
_error | 0 |
---|
隐藏分类: