Erst wenn die letzte Ölplattform versenkt,
die letzte Tankstelle geschlossen ist,
werdet ihr merken,
dass man bei Greenpeace nachts kein Bier kaufen kann.

I was searching for a tutorial for how to generate hyperbolic tessellations programmatically. Since I found none, I guess it is a worthwile thing to use some of my free time to write about my own approaches. This is not a scientific text. Probably there are better solutions to this, and I would be interested in them, so feel free to comment.

I do not yet have a satisfactory way to give unique coordinates to every tile as for example HyperRogue does. If you know how to do this, feel free to send a comment. It has to do with Coxeter Groups.

We will work on the Poincaré Disk Model. In the poincare disk model, the hyperbolic space is the unit circle, and lines are circles and lines perpendicular to this unit circle.

For circles perpendicular to the unit circle, it is easy to see that we have 1+r^2=D^2, where D is the distance between the two centers, because they form a right-angled triangle. Hence, this holds for every line in hyperbolic space that is a circle in euclidean space.

If we want to generate a regular tessellation of regular n-gons, such that at every vertex m such n-gons meet, we need to generate an n-gon with inner angle \alpha = \frac{360^\circ}{m}. We know that the centers of the hyperbolic lines must form an n-gon in euclidean space. The side length of the regular n-gon in euclidean space is q:=2\sin\frac{\pi}{n}.

We now consider two such circles. Their center distance should be q\cdot
D. Their radii r are equal. Fix one of their two intersection points and draw the radii through these intersection points. Together with the segment between their two centers, this forms an isosceles triangle. The angle \varphi between the two radii is complementary to the angle of the normals through this point, and therefore we know that \alpha + \varphi =
180^\circ. The other two angles in this isosceles triangle, let's call them \psi, satisfy \psi + \frac{\varphi}{2} = 90^\circ.

Now we know by basic trigonometry that the height of the triangle is given by r\cdot\sin\psi, and the bottom side q\cdot D satisfies \frac{q\cdot D}{2} = r\cdot\cos\psi.

Inserting the above relation between D and r, we get

\frac{q\cdot\sqrt{1+r^2}}{2} = r\cdot\cos\psi

\frac{q^2}{4}(1+r^2) = r^2\cdot\cos^2\psi

  \frac{q^2}{4} = r^2 (\cos^2\psi - \frac{q^2}{4})

\frac{q^2}{4\cos^2\psi - q^2} = r^2

r = \frac{q}{\sqrt{4\cos^2\psi-q^2}}


\psi + \frac{\varphi}{2} = 90^\circ

\psi + \frac{180^\circ -\alpha}{2} = 90^\circ

\psi + 90^\circ  - \frac{\alpha}{2} = 90^\circ

\psi = \frac{\alpha}{2}

To generate the sides of the polygon, draw circles with radius r around the centers (D\cos\frac{2\pi k}{n},D\sin\frac{2\pi k}{n}) for n=0,\ldots,n-1.

To find the vertices of the hyperbolic n-gon, just calculate the intersection points between neighbouring circles, and choose the one with distance <1 to the origin. See this thread about how to calculate intersections.