File:Hyperbolic coordinates.svg
From testwiki
Jump to navigation
Jump to search
Original file (SVG file, nominally 800 × 800 pixels, file size: 20 KB)
Contents
This file is from Wikimedia Commons and may be used by other projects. The description on its file description page there is shown below.
Summary
| DescriptionHyperbolic coordinates.svg | Hyperbolic coordinates grip on I cartesian quadrant |
| Date | |
| Source | Own work |
| Author | Rocchini |
| Permission (Reusing this file) |
CC-BY 3.0 |
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);
}
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.htmlGFDLGNU Free Documentation Licensetruetrue |
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.
Captions
Add a one-line explanation of what this file represents
Items portrayed in this file
depicts
13 May 2008
20,275 byte
image/svg+xml
d1989a6839d639797d0ee7a74942fc7e974ee0b9
File history
Click on a date/time to view the file as it appeared at that time.
| Date/Time | Thumbnail | Dimensions | User | Comment | |
|---|---|---|---|---|---|
| current | 09:14, 13 May 2008 | 800 × 800 (20 KB) | wikimediacommons>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 usage
There are no pages that use this file.