File:Hexeract ortho petrie.svg

From Wikimedia Commons, the free media repository

Jump to: navigation, search

Hexeract_ortho_petrie.svg(SVG file, nominally 800 × 800 pixels, file size: 13 KB)

[edit] Summary

Description
English: Orthographic projection of hexeract making the petrie polygon
Date

1 August 2008(2008-08-01)

Source

Opera creata dall'uploader (own work by uploader)

Author

Claudio Rocchini

Permission
(Reusing this image)

See below.

[edit] Source Code

void main()
{
	const int ND = 6; const int NV = (1<<ND); const int NE = 192;
	double v[NV][ND]; int e[NE][2];
	double PX[ND] = {
	 0.13397459621556118,
	 0.36602540378443882,
	 0.50000000000000000,
	 0.49999999999999978,
	 0.36602540378443871,
	 0.13397459621556151};
	double PY[ND] = {
	-0.50000000000000000,
	-0.36602540378443865,
	-0.13397459621556140,
	 0.13397459621556129,
	 0.36602540378443837,
	 0.50000000000000033};
 
	double px[NV]; double py[NV];
 
	int i,j,k,l;
 
	for(i=0;i<NV;++i) for(j=0;j<ND;++j) v[i][j] = (i>>j)&1 ? -0.5 : 0.5;
 
	l = 0;
	for(i=0;i<NV-1;++i) for(j=i+1;j<NV;++j) {
		double d = 0;
		for(k=0;k<ND;++k) d += (v[i][k]-v[j][k])*(v[i][k]-v[j][k]);
		d = sqrt(d);
		if(d==1) { e[l][0]=i; e[l][1]=j; ++l;}
	}
	assert(l==NE);
 
        for(i=0;i<NV;++i){
		px[i] = 0; for(l=0;l<ND;++l) px[i] += v[i][l]*PX[l];
		py[i] = 0; for(l=0;l<ND;++l) py[i] += v[i][l]*PY[l];
	}
 
	const double SX = 800; const double SY = 800;
	const double B  = 32;  const double R  = 8;
 
	const double sca  = std::min((SX-2*B)/2,(SY-2*B)/2);
	for(i=0;i<NV;++i) { px[i] = B+(px[i]+1)*sca; py[i] = B+(py[i]+1)*sca; }
 
	FILE * fp = fopen("c:\\temp\\HexeractPetrie.svg","w");
	fprintf(fp,
		"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"
		"<svg\n"
		"xmlns:svg=\"http://www.w3.org/2000/svg\"\n"
		"xmlns=\"http://www.w3.org/2000/svg\"\n"
		"version=\"1.0\"\n"
		"width=\"%g\"\n" "height=\"%g\"\n"
		"id=\"HexeractPetrie\">\n"
		,SX,SY
	);
	fprintf(fp,"<g style=\"stroke:#000000;stroke-width:2;stroke-opacity:0.75;\">\n");
	for(i=0;i<NE;++i)
		fprintf(fp,
			"<line x1=\"%5.1lf\" y1=\"%5.1lf\" x2=\"%5.1lf\" y2=\"%5.1lf\"/>\n"
			,px[e[i][0]],py[e[i][0]], px[e[i][1]],py[e[i][1]]
		);
	fprintf(fp,"</g>\n");
	fprintf(fp,"<g style=\"stroke:#000000;stroke-width:2;stroke-opacity:0.75;fill:#0080FF\">\n");
	for(i=0;i<NV;++i)
		fprintf(fp,"<circle cx=\"%5.1lf\" cy=\"%5.1lf\" r=\"%5.1lf\"/>\n",px[i],py[i],R);
	fprintf(fp,"</g>\n");
	fprintf(fp,"</svg>\n");
	fclose(fp);


[edit] Licensing

I, the copyright holder of this work, hereby publish it under the following licenses:
GNU head Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".

Afrikaans | Alemannisch | Aragonés | العربية | Asturianu | Беларуская | Беларуская (тарашкевіца) | Български | বাংলা | ইমার ঠার/বিষ্ণুপ্রিয়া মণিপুরী | Brezhoneg | Bosanski | Català | Cebuano | Česky | Dansk | Deutsch | Ελληνικά | English | Esperanto | Español | Eesti | Euskara | فارسی | Suomi | Français | Gaeilge | Galego | עברית | Hrvatski | Magyar | Հայերեն | Bahasa Indonesia | Ido | Íslenska | Italiano | 日本語 | ქართული | ភាសាខ្មែរ | 한국어 | Kurdî / كوردی | Latina | Lëtzebuergesch | Lietuvių | 文言 | Македонски | Bahasa Melayu | Malti | Nnapulitano | Plattdüütsch | Nederlands | ‪Norsk (nynorsk)‬ | ‪Norsk (bokmål)‬ | Occitan | Polski | Português | Română | Русский | Slovenčina | Slovenščina | Shqip | Српски / Srpski | Svenska | Kiswahili | తెలుగు | ไทย | Tagalog | Türkçe | Українська | اردو | Vèneto | Tiếng Việt | Volapük | Yorùbá | 中文 | ‪中文(简体)‬ | ‪中文(繁體)‬ | +/−

Creative Commons license
Creative Commons Attribution
This file is licensed under the Creative Commons Attribution 3.0 Unported License. In short: you are free to distribute and modify the file as long as you attribute its author(s) or licensor(s).

العربية | Беларуская (тарашкевіца) | Български | Català | Česky | Deutsch | Ελληνικά | English | Esperanto | Español | Eesti | Euskara | Suomi | Français | עברית | Hrvatski | Magyar | Italiano | 日本語 | 한국어 | Lietuvių | Македонски | Plattdüütsch | Nederlands | Polski | Português | Русский | Svenska | ไทย | Türkçe | Vèneto | ‪中文(简体)‬ | ‪中文(繁體)‬ | +/−

You may select the license of your choice.

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current12:56, 1 August 2008Thumbnail for version as of 12:56, 1 August 2008800×800 (13 KB)Rocchini (talk | contribs) ({{Information |Description={{en|1=Orthographic projection of hexeract making the petrie polygon}} |Source=Opera creata dall'uploader (own work by uploader) |Author=Claudio Rocchini |Date=2008-08-01 |Permission= |other_versions= }} {{Ima)

There are no pages that link to this file.

Global file usage

The following other wikis use this file: