Image:Hyperbolic coordinates.svg
From Wikipedia, the free encyclopedia
Hyperbolic_coordinates.svg (SVG file, nominally 800 × 800 pixels, file size: 20 KB)
| | This is a file from the Wikimedia Commons. The description on its description page there is shown below.
|
[edit] Dettagli
| Description |
Hyperbolic coordinates grip on I cartesian quadrant |
|---|---|
| Source |
self-made |
| Date |
2008-05-13 |
| Author | |
| Permission (Reusing this image) |
CC-BY 3.0 |
[edit] Source Code
in C++
void hyperbolic_coordinates() {
const double DIMX = 800; const double DIMY = 800;
const double B = 64; const double S = 128;
const double miu = -2; const double mau = 2;
const double miv = 0; const double mav = 8;
const int N = 24; const int M = 1024;
FILE * fp = fopen("c:\\temp\\hyperbolic_coordinates.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=\"rocco\">\n"
,DIMX,DIMY
);
fprintf(fp,"<g id=\"edge_layer1\" style=\"fill:none;stroke:#800000;stroke-width:1.5;stroke-opacity:1\">\n" );
int i,j;
for(j=0;j<N;++j) {
const double v = miv + (mav-miv)*double(j)/(N-1);
fprintf(fp, "<path d=\"" );
bool first = true;
for(i=0;i<M;++i) {
const double u = miu + (mau-miu)*double(i)/(M-1);
double x = v*exp( u); double y = v*exp(-u);
x = x*S+B; y = DIMY-(y*S+B);
if(x>=B && x<=DIMX-B && y>=B && y<=DIMY-B ) {
if(first) fprintf(fp,"M ");
else fprintf(fp,"L ");
fprintf(fp,"%g %g ",x,y);
first = false;
}
}
fprintf(fp,"\"/>\n");
}
fprintf(fp,
"</g>\n"
"<g id=\"edge_layer2\" style=\"fill:none;stroke:#000080;stroke-width:1.5;stroke-opacity:1\">\n"
);
for(i=0;i<N ;++i) {
const double u = miu + (mau-miu)*double(i)/(N-1);
fprintf(fp, "<path d=\"");
bool first = true;
for(j=0;j<M;++j) {
const double v = miv + (mav-miv)*double(j)/(M-1);
double x = v*exp( u); double y = v*exp(-u);
x = x*S+B; y = DIMY-(y*S+B);
if(x>=B && x<=DIMX-B && y>=B && y<=DIMY-B ) {
if(first) fprintf(fp,"M ");
else fprintf(fp,"L ");
fprintf(fp,"%g %g ",x,y);
first = false;
}
}
fprintf(fp,"\"/>\n");
}
fprintf(fp,
"</g>\n"
"</svg>\n"
);
fclose(fp);
}
[edit] Licensing
File history
Click on a date/time to view the file as it appeared at that time.
| Date/Time | Dimensions | User | Comment | |
|---|---|---|---|---|
| current | 08:14, 13 May 2008 | 800×800 (20 KB) | Rocchini | ({{Information |Description= Hyperbolic coordinates grip on I cartesian quadrant |Source=self-made |Date=2008-05-13 |Author= Rocchini |Permission=CC-BY 3.0 }} ) |
File links
The following pages on the English Wikipedia link to this file (pages on other projects are not listed):

