# Rpolyhedra

This package is a curation made based on the poly package found on (Original Help message), and the polyhedra database found on, both of which provide polyhedra databases on its own format. As such, Rpolyhedra provides with the following:

  1. A module to scrape the polyhedra for the different sources found with features for incremental correction of issues found and to be found in scraping process.
  2. A database of the scraped polyhedra.
  3. An R6 polyhedron representation with 'rgl' package visualizing capabilites.

| Release | Usage | Development | |:--------|:------|:------------| | | minimal R version | Travis | | CRAN | | codecov |

How to get started


How to get started (Development version)

Install the R package using the following commands on the R console:

devtools::install_github("qbotics/Rpolyhedra", build_opts = NULL)
# if want to switch to fullDB in user filespace, it will download the full database

A simple example of 5 regular polyhedra

To get started execute the following commands:

# 1.  Obtain 5 regular solids
polyhedra.2.draw <- getAvailablePolyhedra(source = "netlib")
polyhedra.2.draw <- polyhedra.2.draw %>%
                        filter( %in%
                            c("tetrahedron", "octahedron", "cube",
                               "icosahedron", "dodecahedron"))

# 2. Setup colors and scales
n <- nrow(polyhedra.2.draw)
polyhedron.colors <- rainbow(n)
polyhedron.scale <- 5

# 3. open and setup RGL window
par3d(FOV = 1) sphere =FALSE, fogtype = "none", color=c("black"))
rgl.viewpoint(theta = 0, phi=0, zoom=0.8, fov=1)

# 4. for each polyhedron, setup rotation, position and render
for (i in seq_len(n)) {
  # Obtain polyhedron
  polyhedron.row <- polyhedra.2.draw[i,] <- polyhedron.row$
  polyhedron <- getPolyhedron(source = polyhedron.row$source,

  # Setup angles, position into transformationMatrix
  current.angle <- i/n * 2 * pi
  tm <- rotationMatrix(current.angle, 1, 0, 0)
  x.pos <- round(polyhedron.scale * sin(current.angle), 2)
  y.pos <- round(polyhedron.scale * cos(current.angle), 2)
  tm <- tm %*% translationMatrix(x.pos, y.pos, 0)

  # Render
  print(paste("Drawing ",, " rotated ", round(current.angle, 2),
              " in (1,0,0) axis. Translated to (", x.pos, ",", y.pos, ",0)",
              " with color ", polyhedron.colors[i], sep = ""))
  shape.rgl <- polyhedron$getRGLModel(transformation.matrix = tm)
  shade3d(shape.rgl, color = polyhedron.colors[i])



Includes 142 polyhedra definitions. The PHD format was created to describe the geometric polyhedron definitions derived mathematically by Andrew Hume and by the Kaleido program of Zvi Har'El.

PHD files were generated using poly2 library (no longer mantained). Althought the code is available, specific programming skills are required to run it.

PDH files can be found in extdata/


Includes 767 polyhedra definitions. The polyhedra database built by David Mccooey has an open format which has been scraped to feed RPolyhedra database

dmccooney files can be found in extdata/




apt-get install libcurl4-openssl-dev


run end user CRAN version

OSX brew

brew install openssl

After, in R:




sudo apt-get install r-cran-rgl

Please note that the 'Rpolyhedra' project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

Try the Rpolyhedra package in your browser

Any scripts or data that you put into this service are public.

Rpolyhedra documentation built on Feb. 21, 2019, 4:33 p.m.