Reference

Contents

Index

PoincareDisk._circle_through — Method
_circle_through(z1, z2, z3) -> (center::Complex, radius::Float64)

Find the Euclidean circumcenter/radius of three complex points. This is used for reflections which operate in unscaled disk coordinates rather than drawing coordinates.

source
PoincareDisk._geodesic_arc_info — Method
_geodesic_arc_info(a, b; radius=DEFAULT_DISK_RADIUS, diskcenter=O)

Build the hyperbolic geodesic that passes through disk points a and b. It can either be a circular arc or a straight line - which happens when a and b form a diameter.

Returns one of three different results:

  • (:arc, center, r, theta1, theta2) — the geodesic is

an arc centered at center with radius r. The arc runs counterclockwise from angle theta1 to theta2 and does not pass through the excluded point (the inversion of a in the unit circle).

  • (:carc, center, r, theta1, theta2) — the geodesic is

an arc centered at center with radius r, but the non-excluded arc runs clockwise from theta1 to theta2.

  • (:line, p1, p2) — a, b, and the origin are collinear, so the geodesic is just a straight line between the points p1 and p2.

The unique circle orthogonal to the unit circle that passes through a and b also passes through a* = 1/conj(a), the inversion of a in the unit circle. The geodesic arc is the arc of the circle through (a, b, a*) that avoids a*.

source
PoincareDisk.complex_to_point — Method
complex_to_point(z; radius=DEFAULT_DISK_RADIUS, diskcenter::Point=O)

Convert a point z on the unit disk (a complex number with |z| < 1) into a Point on the Luxor drawing, scaling by radius and shifting so the disk is centered at diskcenter.

Uses the global constant DEFAULT_DISK_RADIUS.

source
PoincareDisk.draw_tiling — Method
draw_tiling(tiles; 
    radius=DEFAULT_DISK_RADIUS, 
    diskcenter=O, 
    action=:fill, 
    colors=nothing)

Draw the hyperbolic tiling produced by hyperbolic_tiling() by drawing every hyperpolygon in the array of tiles, using the provided colors.

Apply Luxor action to the path that describes each tile. The default is :fill.

colors can be supplied as an array of two colorants. The generation number of each tile is used to alternate between the two colours. If q is even, the tiling has a "chess board" appearance.

Otherwise random colors are used.

Use radius to specify the radius of the Poincaré disk when drawing points.

source
PoincareDisk.hyperbolic_circle — Method
hyperbolic_circle(center, rho; 
    radius=DEFAULT_DISK_RADIUS, 
    diskcenter=O, 
    action=:stroke)

Construct the hyperbolic circle of hyperbolic radius rho centered at disk point center. The action (default :stroke) is applied.

Return the Luxor coordinates of the circle's center and radius.

source
PoincareDisk.hyperbolic_line — Method
hyperbolic_line(z1, z2; 
    radius=DEFAULT_DISK_RADIUS, 
    diskcenter=O, 
    action=:stroke)

Construct a new path that makes the hyperbolic geodesic between disk points z1 and z2 as a circular arc (or a straight line, if collinear).

Then the action is applied. The default action is :stroke.

Returns either the (center, radius) of a circle that would contain the arc, or (nothing, nothing) if it's a diameter.

source
PoincareDisk.hyperbolic_point — Method
hyperbolic_point(z; 
    radius=DEFAULT_DISK_RADIUS, 
    dotradius = 5, 
    diskcenter=O)

Draw a small filled circle of radius dotradius to mark the location of the hyperbolic point at complex number z. Return the coordinates of the Luxor point.

source
PoincareDisk.hyperbolic_poly — Method
hyperbolic_poly(vertices; 
    radius=DEFAULT_DISK_RADIUS, 
    diskcenter=O, 
    action=:stroke)

Construct the closed hyperbolic polygon with vertices, joined by geodesic edges. Each side is built with a circular arc or straight line, giving a chain of arc/carc/line path elements.

Finally apply the Luxor action action to the resulting path. The default is :stroke.

Return nothing.

The unique circle orthogonal to the unit circle that passes through a and b also passes through a* = 1/conj(a), the inversion of a in the unit circle. The geodesic circle is the circle through 3 points ((a, b, a*).

For hyperbolic circles, the hyperbolic center moves to the origin via a Möbius mapping, so a hyperbolic circle of radius rho is the Euclidean circle of radius tanh(rho/2).

source
PoincareDisk.hyperbolic_tiling — Method
hyperbolic_tiling(p, q; 
    depth = 8, 
    hcenter = 0.0 + 0.0im, 
    rotation = 0.0, 
    maxtiles = 4000)

Construct the coordinates for a hyperbolic tiling of the Poincaré disk with polygons with p sides and q lines joining at each vertex.

Returns an array where each element contains:

  • an array of complex numbers (the disk coordinates of each polygon)

  • the tile's generation number: depth specifies how many generations

maxtiles tiles limits the number of tiles generated.

p and q must satisfy 1/p + 1/q < 1/2. The simpler tilings are listed in this table:

p:q123456789101112
1
2
3✓✓✓✓✓✓
4✓✓✓✓✓✓✓✓
5✓✓✓✓✓✓✓✓✓
6✓✓✓✓✓✓✓✓✓
7✓✓✓✓✓✓✓✓✓✓
8✓✓✓✓✓✓✓✓✓✓
9✓✓✓✓✓✓✓✓✓✓
10✓✓✓✓✓✓✓✓✓✓
11✓✓✓✓✓✓✓✓✓✓
12✓✓✓✓✓✓✓✓✓✓

For example, (5, 4), (7, 3), and (4, 5) are all accepted. The 'simplest' tiling of a triangle is (3, 7), such that 7 lines connect at each of the triangles' vertices.

Starting with the basic polygon, a hyperbolic polygon centered at hcenter, the tiling is built by reflecting each tile across each of its edges. A hyperbolic reflection is an inversion in the edge's circle.

source
PoincareDisk.mobius_to_origin — Method
mobius_to_origin(z, a)

Apply a Möbius transformation that maps the unit disk to itself. This "recenters" the disk so that the point a moves to the origin 0 while everything stays inside the unit disk. Angles are preserved.

source