---
title: "Get started with 'gyro'"
output: 
  rmarkdown::html_vignette:
    css: vignette.css
vignette: >
  %\VignetteIndexEntry{Get started with 'gyro'}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
```

```{r setup}
library(gyro)
```


About three years ago, I wrote an 
[article on my blog](https://laustep.github.io/stlahblog/posts/hyperbolicPolyhedra.html) 
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](http://dmccooey.com/polyhedra/index.html) 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](http://dmccooey.com/polyhedra/index.html) 
website. From the faces you can derive the edges. See `gyrodemos()` for some 
examples. The [eusebeia](https://www.qfbox.info/4d/index) website is 
another resource to find the Cartesian coordinates of the vertices of some 
polyhedra. Finally you can also use the R package 
[Rpolyhedra](https://CRAN.R-project.org/package=Rpolyhedra). 

The **gyro** package also offers the `tiling` function to plot hyperbolic 
tilings of the Poincaré disk.
