File:Horocycle normals.svg

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Original file(SVG file, nominally 800 × 800 pixels, file size: 6 KB)

Captions

Captions

Add a one-line explanation of what this file represents

Summary[edit]

Description
English: Horocycle in Poincaré disk model and some normals
Date
Source Own work
Author Claudio Rocchini
Permission
(Reusing this file)
CC-BY 3.0

Source[edit]

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);
}

Licensing[edit]

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.
w:en:Creative Commons
attribution
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.

File history

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

Date/TimeThumbnailDimensionsUserComment
current11:51, 30 May 2008Thumbnail for version as of 11:51, 30 May 2008800 × 800 (6 KB)Rocchini (talk | contribs){{Information |Description={{en|1=Horocycle in Poincaré disk model and some normals}} |Source=Opera creata dall'uploader (own work by uploader) |Author=Claudio Rocchini |Date=2008-05-30 |Permission=CC-BY 3.0 |other_versions= }} {{Image

The following page uses this file:

File usage on other wikis

The following other wikis use this file: