Learn R Programming

⚠️There's a newer version (0.5.4) of this package.Take me there.

Rpolyhedra

Polyhedra database scraped from public available sources using R6 objects and 'rgl' visualizing capabilities.

ReleaseUsageDevelopment

How to get started

install.packages("Rpolyhedra")

How to get started (Development version)

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

install.packages(c("futile.logger", "rgl", "stringr", "R6", "testthat", "devtools"))
devtools::install_github("qbotics/Rpolyhedra")
library(Rpolyhedra)
# if want to switch to fullDB in user filespace, it will download the full database
switchToFullDatabase()

A simple example of 5 regular polyhedra

To get started execute the following commands:

polyhedra.2.draw <- getAvailablePolyhedra(source = "netlib")
polyhedra.2.draw <- polyhedra.2.draw[polyhedra.2.draw$scraped.name %in%
                                       c("tetrahedron","octahedron","cube","icosahedron","dodecahedron"),]

n <- nrow(polyhedra.2.draw)
polyhedron.colors <- rainbow(n)
polyhedron.scale <- 5

open3d()
par3d(FOV = 1)
rgl.bg( sphere =FALSE, fogtype = "none", color=c("black"))
rgl.viewpoint(theta = 0,phi=0,zoom=0.8,fov=1)
for (i in seq_len(n)) {
  polyhedron.row <- polyhedra.2.draw[i,]
  polyhedron.name <- polyhedron.row$scraped.name
  polyhedron <- getPolyhedron(source = polyhedron.row$source, polyhedron.name)
  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)
  print(paste("Drawing ",polyhedron.name," 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])
}

sources

netlib

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/www.netlib.org/polyhedra/index.html

Dmccooey

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/dmccooey.com/polyhedra/

Troubleshooting

devtools

Ubuntu

apt-get install libcurl4-openssl-dev

Windows

run end user CRAN version

OSX brew

brew install openssl

After, in R:

install.packages("devtools")

rgl

Ubuntu

sudo apt-get install r-cran-rgl

Copy Link

Version

Install

install.packages('Rpolyhedra')

Monthly Downloads

561

Version

0.3.0

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Alejandro Baranek

Last Published

November 30th, 2018

Functions in Rpolyhedra (0.3.0)

ScraperLedger.class

ScraperLedger
checkVertices

checkVertices()
getGitCommit

getGitCommit get the last git commit sha
getPercentilPolyhedraQuant

getPercentilPolyhedraQuant returns polyhedra quantity of parameter percentil
Rpolyhedra

Rpolyhedra
getEnvironmentFilepath

getEnvironmentFilepath
PolyhedronStateDeserializer.class

Polyhedron State Deserializer
PolyhedronTestTaskScrape.class

PolyhedronTestTaskScrape
downloadRPolyhedraSupportingFiles

downloadRPolyhedraSupportingFiles
getAvailablePolyhedra

getAvailablePolyhedra()
copyFilesToExtData

copyFilesToExtData
getPackageDB

getPackageDB
PolyhedronTestTask.class

PolyhedronTestTask
getAvailableSources

getAvailableSources()
PolyhedronTestTaskEdgesConsistency.class

PolyhedronTestTaskEdgesConsistency
getPolyhedraObject

getPolyhedraObject
getUserSpace

getUserSpace
maxWithoutNA

maxWithoutNA Function that returns NA if all elements are NA, and the max value not NA, if not.
getPackageDir

getPackageDir
getPackageEnvir

getPackageEnvir
hydratePolyhedron

hydratePolyhedron
getPolyhedraRDSPath

getPolyhedraRDSPath
getPolyhedron

getPolyhedron()
checkDatabaseVersion

checkDatabaseVersion
getDataEnv

getDataEnv
setPackageEnvir

setPackageEnvir
setUserEnvir

setUserEnvir
getDatabaseVersion

getDatabaseVersion
scrapePolyhedra

scrapePolyhedra()
getPackageVersion

getPackageVersion
getPreloadedDataFilename

getPreloadedDataFilename
switchToFullDatabase

switchToFullDatabase()
updatePolyhedraDatabase

updatePolyhedraDatabase
norm

norm calculates norm of a vector
scrapePolyhedraSources

scrapePolyhedraSources()
persistPolyhedron

persistPolyhedron
getUserEnvir

getUserEnvir
getDataDir

getDataDir
polyhedronToXML

polyhedronToXML()
initDataDirEnvironment

initDataDirEnvironment
isCompatiblePolyhedraRDS

isCompatiblePolyhedraRDS()
selectDataEnv

selectDataEnv
setDataDirEnvironment

setDataDirEnvironment
PolyhedronScraperConfiguration.class

PolyhedronScraperConfiguration
PolyhedronScraperConfigurationDmccoey.class

PolyhedronScraperConfigurationDmccoey
PolyhedronStateDefined.class

Polyhedron State Defined
PolyhedronStateDmccoeyScraper.class

Polyhedron State Dmccoey Scraper
PolyhedraDatabase.class

PolyhedraDatabase
Polyhedron.class

Polyhedron
PolyhedronStateNetlibScraper.class

Polyhedron State Netlib Scraper
PolyhedronScraperConfigurationNetlib.class

PolyhedronScraperConfigurationNetlib
PolyhedronState.class

Polyhedron State