From Wikipedia, the free encyclopedia
[edit] Dettagli
Description |
English: Horocycle in Poincaré disk model and some normals
|
Source |
Opera creata dall'uploader (own work by uploader)
|
Date |
2008-05-30
|
Author |
Claudio Rocchini
|
Permission
(Reusing this image) |
CC-BY 3.0
|
[edit] Source
You need some basic 2d gemetric functions (line line intersection, circle circle inter. etc)
void Horocycle()
{
const double DIMX = 800;
const double DIMY = 800;
const double B = 32;
FILE * fp = fopen("c:\\temp\\horocycle.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
);
circle2 gc; gc.c = point2(DIMX/2,DIMY/2); gc.r = (DIMX-2*B)/2;
fprintf(fp,"<circle cx=\"%g\" cy=\"%g\" r=\"%g\" style=\"fill:#ffffE0;stroke:#000000;stroke-width:3;stroke-opacity:1\" />\n"
,gc.c.x,gc.c.y
,gc.r
);
circle2 hc; hc.r = DIMX/3; hc.c = point2(DIMX/2,B+hc.r);
fprintf(fp,"<circle cx=\"%g\" cy=\"%g\" r=\"%g\" style=\"fill:none;stroke:#0000A0;stroke-width:3;stroke-opacity:1\" />\n"
,hc.c.x,hc.c.y
,hc.r
);
const int N = 24;
int i;
for(i=0;i<N;++i)
{
double a = 2*PI*i/N + PI/N;
point2 p = hc.point(a);
fprintf(fp,"<circle cx=\"%g\" cy=\"%g\" r=\"%g\" style=\"fill:#000000;stroke:#000000;stroke-width:3;stroke-opacity:1\" />\n"
,p.x,p.y
,4.0
);
segment2 s( p, point2(DIMX/2,B) );
line2 ax; s.axis(ax);
line2 ba; ba.orig.x = DIMX/2; ba.orig.y = B; ba.dire.x = 1; ba.dire.y = 0;
point2 pp; line_line_int(ax,ba,pp);
double ra = dist(pp,p);
circle2 cc; cc.c = pp; cc.r = ra;
point2 p1,p2; intersection(cc,gc,p1,p2);
fprintf(fp,"<path d=\"M%g,%g A%g,%g 0 0,1 %g,%g\" style=\"fill:none;stroke:#800000;stroke-width:1.5;stroke-opacity:1\" />\n"
,p1.x,p1.y
,cc.r,cc.r
,p2.x,p2.y
);
}
fprintf(fp,"</svg>\n");
fclose(fp);
}
I, the copyright holder of this work, hereby publish it under the following licenses:
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/Time | Dimensions | User | Comment |
current | 11:51, 30 May 2008 | 800×800 (6 KB) | Rocchini | |
File links
The following pages on the English Wikipedia link to this file (pages on other projects are not listed):