Demipenteract_graph_ortho.svg
Size of this PNG preview of this SVG file:
600 × 600 pixels
.
Other resolutions:
240 × 240 pixels
|
480 × 480 pixels
|
768 × 768 pixels
|
1,024 × 1,024 pixels
|
2,048 × 2,048 pixels
.
Summary
Description Demipenteract graph ortho.svg |
English:
Othographic projection of Demipenteract (edge gragh)
|
Date | |
Source | Own work |
Author | Claudio Rocchini |
Source Code
static int nbit( int x ) {
int n = 0;
while(x) { if(x&1) ++n; x >>= 1; }
return n;
}
void main() {
const int D = 5; const int NV = 16; const int NE = 80;
double v[NV][D]; int e[NE][2];
double px[NV]; double py[NV];
// Magic numbers
const double x1 = -.1464466094; const double y1 = .3535533906;
const double x2 = -.1464466094; const double y2 = -.3535533906;
const double x3 = -.3535533906; const double y3 = .1464466094;
const double y4 = -.1464466094; const double x4 = -.3535533906;
const double x5 = 0; const double y5 = 0;
const double PX[D] = {x1,x2,x3,x4,x5};
const double PY[D] = {y1,y2,y3,y4,y5};
int i,j,k,l;
for(k=0,i=0;i<(1<<D);++i) if(nbit(i)%2==0){
for(j=0;j<D;++j) v[k][j] = (i>>j)&1 ? 1.0 : -1.0;
++k;
}
assert(k==NV);
for(k=0,i=0;i<NV-1;++i) for(j=i+1;j<NV;++j) {
double d = 0;
for(l=0;l<D;++l) { double t = v[i][l]-v[j][l]; d += t*t; }
if(d==8) { e[k][0]=i; e[k][1]=j; ++k; }
}
for(i=0;i<NV;++i){
px[i] = 0; for(l=0;l<D;++l) px[i] += v[i][l]*PX[l];
py[i] = 0; for(l=0;l<D;++l) py[i] += v[i][l]*PY[l];
}
const double SX = 800; const double SY = 800;
const double B = 64; const double R = 12;
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\\Demipenteract_Graph2.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=\"Demipenteract_Graph2\">\n"
,SX,SY
);
fprintf(fp,"<g style=\"stroke:#000000;stroke-width:3;stroke-opacity:1.0;\">\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;fill:#0000E0\">\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);
}
Licensing
I, the copyright holder of this work, hereby publish it under the following licenses:
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 . http://www.gnu.org/copyleft/fdl.html GFDL GNU Free Documentation License true true |
This file is licensed under the
Creative Commons
Attribution 3.0 Unported
license.
-
You are free:
- to share – to copy, distribute and transmit the work
- to remix – to adapt the work
-
Under the following conditions:
- attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
You may select the license of your choice.