#Introduction This package is a curation made based on the poly package found on http://www.netlib.org/polyhedra/ (Original Help message), which provides a library of polyhedron and its representation. As such, Rpolyhedra provides with the following:

  1. A module to scrape the polyhedra PHD files provided by the original poly command.
  2. A library of the scraped polyhedra.
  3. An R6 polyhedron representation with ‘rgl’ package visualizing capabilites.

#Usage The package provides a simplified set of functions to scrape, show the scrapped polyhedra and access each individual polyhedron.

##Scrape polyhedra In order to scrape, the following code can be executed to retrieve all polyhedra from the original files produced by the poly command.

polyhedra <- scrapePolyhedra(max.quant = 5, "polyhedra.RDS", home.dir.data = getDataDir(),
test = TRUE)

##Get available polyhedra Once the original files had been processed, a simple call to getAvailablePolyhedra() retrieves a list of the available polyhedra:


##Retrieve a polyhedron The access to a particular polyhedron can be done with a call to getPolyhedron(<<name>>), which returns a Polyhedron object. For example, to retrieve a cube, the call would be:


#A demo To try package funcionality, a simple demo can be executed which shows the 5 regular polyhedra.

polyhedra.2.draw <- getAvailablePolyhedra()[1:5]
n <- length(polyhedra.2.draw)
polyhedron.colors <- rainbow(n)
polyhedron.scale <- 5
par3d(FOV = 1)
rgl.bg( sphere =FALSE, fogtype = "none", color=c("black"))
rgl.viewpoint(theta = 0,phi=0,zoom=0.8,fov=1)
i <- 1
for (polyhedron.name in polyhedra.2.draw) {
polyhedron <- getPolyhedron(polyhedron.name)
current.angle <- i/n * 2 * pi
shape.rgl <- polyhedron$getRGLModel(1, c(polyhedron.scale * sin(current.angle),
polyhedron.scale * cos(current.angle),
shade3d(shape.rgl, color = polyhedron.colors[i])
i <- i + 1