Function Repository Resource:

HyperbolicPoincarePolygon

Source Notebook

Represent a hyperbolic polygon embedded in the Poincaré disk

Contributed by: Jan Mangaldan

ResourceFunction["HyperbolicPoincarePolygon"][{p1,,pn}]

represents a filled hyperbolic polygon with points pi, embedded in the Poincaré disk.

Details

ResourceFunction["HyperbolicPoincarePolygon"] can be used as a graphics primitive.
ResourceFunction["HyperbolicPoincarePolygon"] returns a FilledCurve object.
The points pi must all have dimension 2, and must all lie within the unit disk.

Examples

Basic Examples (2) 

A random hyperbolic triangle:

In[1]:=
tri = ResourceFunction["HyperbolicPoincarePolygon"][
   RandomPoint[Disk[], 3]];

Show the hyperbolic triangle in the Poincaré disk:

In[2]:=
Graphics[{{Thick, Circle[]}, tri}]
Out[2]=

Scope (4) 

Use directives to style the polygon:

In[3]:=
qq = ResourceFunction["HyperbolicPoincarePolygon"][
   N@CirclePoints[Tanh[3/2], 4]];
In[4]:=
Graphics[{{Thick, Circle[]}, {Blue, qq}}]
Out[4]=
In[5]:=
Graphics[{{Thick, Circle[]}, {Directive[EdgeForm[Directive[Dashed, Thick, Blue]], Yellow], qq}}]
Out[5]=

A concave polygon:

In[6]:=
Graphics[{{Thick, Circle[]}, {Brown, ResourceFunction[
    "HyperbolicPoincarePolygon"][{{-0.5, -0.5}, {0., 0.}, {0.5, -0.5}, {0., 0.8}}]}}]
Out[6]=

A triangle with a side that goes through the origin:

In[7]:=
Graphics[{{Thick, Circle[]}, {Pink, ResourceFunction[
    "HyperbolicPoincarePolygon"][{{0, -0.5}, {0., 0.5}, {0.7, 0.}}]}}]
Out[7]=

A triangle with points at infinity:

In[8]:=
Graphics[{{Thick, Circle[]}, {Green, ResourceFunction[
    "HyperbolicPoincarePolygon"][{{0.8, 0.6}, {-0.6, 0.8}, {0.2, -0.2}}]}}]
Out[8]=

Properties and Relations (1) 

HyperbolicPoincarePolygon returns a FilledCurve object:

In[9]:=
ResourceFunction[
  "HyperbolicPoincarePolygon"][{{0., 0.}, {0.5, 0.}, {0., 0.5}}] // Head
Out[9]=

Possible Issues (1) 

All vertices of HyperbolicPoincarePolygon must lie within the unit disk:

In[10]:=
ResourceFunction[
 "HyperbolicPoincarePolygon"][{{2., 0.}, {0., 0.}, {0., 0.7}}]
Out[10]=

Neat Examples (1) 

Show a regular hyperbolic polygon in the Poincaré disk:

In[11]:=
hyperbolicRotate[z_, {zc_, \[Theta]_}] := With[{f = (z - zc)/(1 - z Conjugate[zc]) Exp[I \[Theta]]}, (zc + f)/(
  1 + f Conjugate[zc])]
In[12]:=
regularHyperbolicPolygon[n_, r_, cent_ : {0, 0}] := Module[{c, poly, v},
  v = Tanh[r/2] Exp[I (\[Pi]/n - \[Pi]/2)];
  poly = NestList[hyperbolicRotate[#, {0, (2 \[Pi])/n}] &, v, n - 1];
  c = cent . {1, I};
  If[Abs[c] > 0,
   poly = (poly + c)/(1 + Conjugate[c] poly)];
  ResourceFunction["HyperbolicPoincarePolygon"][ReIm[N[poly]]]]
In[13]:=
Manipulate[
 Graphics[{{Thick, Circle[]}, {Directive[EdgeForm[Directive[Thick, GrayLevel[0.3]]], FaceForm[ColorData[61, 3]]], regularHyperbolicPolygon[n, r, c]}}, {BaseStyle -> {FilledCurveBoxOptions -> {Method -> {"SplinePoints" -> 18}}}, PlotRange -> 1}], {{n, 3, "number of sides"}, 3, 12,
   1}, {{r, 1, "radius"}, 1/10, 5}, {{c, {0, 0}}, Locator}, SaveDefinitions -> True]
Out[13]=

Version History

  • 1.0.0 – 08 February 2021

Related Resources

Author Notes

HyperbolicPoincarePolygon relies the NURBS representation of a circle arc, which can also easily handle the case where a geodesic representing a side of the polygon passes through a diameter of the disk.

License Information