library(gyro)
About three years ago, I wrote an article on my blog about Ungar’s approach to hyperbolic geometry, and how it can be used to draw some hyperbolic polyhedra in R, using the rgl package. I invite you to take a look at this article.
Now I’ve implemented these ideas in the gyro package. Maybe you know there are several models of hyperbolic geometry; gyro deals with the hyperboloid model (or Minkowski model) and the Poincaré model.
The main functions of the gyro package dealing with 3D polyhedra are:
gyrotube
, to draw a tubular hyperbolic segment (if
you don’t want a tube, use gyrosegment
instead);
gyrotriangle
, to draw a filled hyperbolic triangle
in the 3D space;
plotGyrohull3d
, to draw the hyperbolic convex hull
of a set of 3D points.
You can run gyrodemos()
to get some examples of code
which draw some hyperbolic polyhedra.
If you are looking for other polyhedra, you can go to the
Visual Polyhedra page of the dmccooey website.
Here you will find the Cartesian coordinates of the vertices of many
polyhedra. If the polyhedron is convex (in the Euclidean space), use
plotGyrohull3d
to quickly draw it. Otherwise you need to
know the faces of the polyhedron, and they are given on the dmccooey website.
From the faces you can derive the edges. See gyrodemos()
for some examples. The eusebeia website is another
resource to find the Cartesian coordinates of the vertices of some
polyhedra. Finally you can also use the R package Rpolyhedra.
The gyro package also offers the tiling
function to plot hyperbolic tilings of the Poincaré disk.