rpolyhedra

A polyhedra database scraped from public available sources using R6 (OOP) and 'rgl' visualizing capabilities.

https://github.com/ropensci/rpolyhedra

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (19.4%) to scientific vocabulary

Keywords

geometry polyhedra-database rgl
Last synced: 6 months ago · JSON representation

Repository

A polyhedra database scraped from public available sources using R6 (OOP) and 'rgl' visualizing capabilities.

Basic Info
Statistics
  • Stars: 12
  • Watchers: 4
  • Forks: 6
  • Open Issues: 10
  • Releases: 0
Topics
geometry polyhedra-database rgl
Created over 8 years ago · Last pushed over 1 year ago
Metadata Files
Readme Changelog Contributing License Code of conduct Codemeta

README.Rmd

---
output: github_document
---



```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  dpi=200,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)
```



# Rpolyhedra

[![Downloads](http://cranlogs.r-pkg.org/badges/Rpolyhedra?color=brightgreen)](https://www.r-pkg.org:443/pkg/Rpolyhedra)
[![Downloads](http://cranlogs.r-pkg.org/badges/grand-total/Rpolyhedra?color=brightgreen)](https://www.r-pkg.org:443/pkg/Rpolyhedra)


 


 This package is a polyhedra database based on the poly package found on https://netlib.org/polyhedra/ ([Original Help message](https://raw.githubusercontent.com/ropensci/Rpolyhedra/master/man/html/poly_original_help_message.html)), and the polyhedra definitions found on http://dmccooey.com/polyhedra/. 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.
 1. A database of the scraped polyhedra.
 1. An R6 polyhedron representation with 'rgl' package visualizing capabilities.


| Release | Usage | Development |
|:--------|:------|:------------|
| [![](https://badges.ropensci.org/157_status.svg)](https://github.com/ropensci/software-review/issues/157)| [![minimal R version](https://img.shields.io/badge/R%3E%3D-3.4.0-blue.svg)](https://cran.r-project.org/) | 
[![R-CMD-check](https://github.com/ropensci/Rpolyhedra/workflows/R-CMD-check/badge.svg)](https://github.com/ropensci/Rpolyhedra/actions) |
| [![CRAN](https://www.r-pkg.org:443/pkg/Rpolyhedra)](https://cran.r-project.org/package=Rpolyhedra) | | [![codecov](https://codecov.io/gh/ropensci/Rpolyhedra/branch/master/graph/badge.svg)](https://app.codecov.io/gh/ropensci/Rpolyhedra) |
|||[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)|

# Preview
Through [Rpolyhedraexplorer](https://qbotics.shinyapps.io/rpolyhedra-explorer/) you can navigate the polyhedra database without actually installing R environment.

# How to get started
```R
install.packages("Rpolyhedra")
```

# How to get started (Development version)

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

```R
devtools::install_github("ropensci/Rpolyhedra", build_opts = NULL)
```

# Loading the database
```{r, rpolyhedra}
library(Rpolyhedra)
```

```R
# if want to switch to fullDB in user filespace, it will ask you for downloading the full database to your home directory
switchToFullDatabase()
```

# A simple example of 5 regular polyhedra

To get started execute the following commands:

```{r, libraries}
# 0.  Load libraries
library(knitr)
library(rgl)
# For foarding webgl output to knitr
knit_hooks$set(webgl = hook_webgl)
library(dplyr)

```

```{r, 1-retrieve}

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

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

polyhedron.scale <- 5
```

```{r, render}
# For interactive RGL window
#```{r, render, webgl=TRUE}
# 3. open and setup RGL window
open3d()
par3d(FOV = 1)
rgl.bg( 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.name <- polyhedron.row$scraped.name
  polyhedron <- getPolyhedron(source = polyhedron.row$source, polyhedron.name)

  # 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 ", 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])
}

#rgl::rglwidget()
#rgl::rgl.snapshot("man/figures/README-5-polyhedra.png")
```

![5-polyhedra](man/figures/README-5-polyhedra.png)

## 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](https://netlib.org/poly2/readme) library (no longer maintained). Although the code is available, specific programming skills are required to run it.

PHD files can be found in `extdata/netlib.org/polyhedra/index.html`

### dmccooey
Includes 767 polyhedra definitions.
The [polyhedra database](http://dmccooey.com/polyhedra/) built by David Mccooey has an open format which has been scraped to feed Rpolyhedra database

dmccooey files can be found in `extdata/dmccooey.com/polyhedra/`

# Troubleshooting

## devtools

### Ubuntu

```bash
apt-get install libcurl4-openssl-dev
```

### Windows

run end user CRAN version

### macOS brew

```bash
brew install openssl
```
After, in R:

```R
install.packages("devtools")
```

## rgl

### Ubuntu
```bash
sudo apt-get install r-cran-rgl
```


Please note that the 'Rpolyhedra' project is released with a [Contributor Code of Conduct](https://github.com/ropensci/Rpolyhedra/blob/master/CODE_OF_CONDUCT.md). By [contributing](https://github.com/ropensci/Rpolyhedra/blob/master/CONTRIBUTING.md) to this project, you agree to abide by its terms.


[![ropensci_footer](https://ropensci.org/public_images/ropensci_footer.png)](https://ropensci.org)

Owner

  • Name: rOpenSci
  • Login: ropensci
  • Kind: organization
  • Email: info@ropensci.org
  • Location: Berkeley, CA

CodeMeta (codemeta.json)

{
  "@context": "https://doi.org/10.5063/schema/codemeta-2.0",
  "@type": "SoftwareSourceCode",
  "identifier": "Rpolyhedra",
  "description": "A polyhedra database scraped from various sources as R6 objects and 'rgl' visualizing capabilities.",
  "name": "Rpolyhedra: Polyhedra Database",
  "relatedLink": "https://docs.ropensci.org/Rpolyhedra/",
  "codeRepository": "https://github.com/ropensci/Rpolyhedra",
  "issueTracker": "https://github.com/ropensci/Rpolyhedra/issues",
  "license": "https://spdx.org/licenses/MIT",
  "version": "0.5.6",
  "programmingLanguage": {
    "@type": "ComputerLanguage",
    "name": "R",
    "url": "https://r-project.org"
  },
  "runtimePlatform": "R version 4.4.1 (2024-06-14)",
  "provider": {
    "@id": "https://cran.r-project.org",
    "@type": "Organization",
    "name": "Comprehensive R Archive Network (CRAN)",
    "url": "https://cran.r-project.org"
  },
  "author": [
    {
      "@type": "Person",
      "givenName": "Alejandro",
      "familyName": "Baranek",
      "email": "abaranek@dc.uba.ar"
    },
    {
      "@type": "Person",
      "givenName": "Leonardo",
      "familyName": "Belen",
      "email": "leobelen@gmail.com"
    }
  ],
  "contributor": [
    {
      "@type": "Person",
      "givenName": "Alejandro",
      "familyName": "Baranek",
      "email": "abaranek@dc.uba.ar"
    },
    {
      "@type": "Person",
      "givenName": "Leonardo",
      "familyName": "Belen",
      "email": "leobelen@gmail.com"
    }
  ],
  "copyrightHolder": [
    {
      "@type": "Person",
      "givenName": "Alejandro",
      "familyName": "Baranek",
      "email": "abaranek@dc.uba.ar"
    },
    {
      "@type": "Person",
      "givenName": "Leonardo",
      "familyName": "Belen",
      "email": "leobelen@gmail.com"
    },
    {
      "@type": "Organization",
      "name": "qbotics",
      "email": "qbotics6@gmail.com"
    }
  ],
  "maintainer": [
    {
      "@type": "Person",
      "givenName": "Alejandro",
      "familyName": "Baranek",
      "email": "abaranek@dc.uba.ar"
    }
  ],
  "softwareSuggestions": [
    {
      "@type": "SoftwareApplication",
      "identifier": "testthat",
      "name": "testthat",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=testthat"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "knitr",
      "name": "knitr",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=knitr"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "pkgdown",
      "name": "pkgdown",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=pkgdown"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "rmarkdown",
      "name": "rmarkdown",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=rmarkdown"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "covr",
      "name": "covr",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=covr"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "codemetar",
      "name": "codemetar",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=codemetar"
    }
  ],
  "softwareRequirements": {
    "1": {
      "@type": "SoftwareApplication",
      "identifier": "R",
      "name": "R",
      "version": ">= 3.5.0"
    },
    "2": {
      "@type": "SoftwareApplication",
      "identifier": "R6",
      "name": "R6",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=R6"
    },
    "3": {
      "@type": "SoftwareApplication",
      "identifier": "geometry",
      "name": "geometry",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=geometry"
    },
    "4": {
      "@type": "SoftwareApplication",
      "identifier": "rgl",
      "name": "rgl",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=rgl"
    },
    "5": {
      "@type": "SoftwareApplication",
      "identifier": "stringr",
      "name": "stringr",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=stringr"
    },
    "6": {
      "@type": "SoftwareApplication",
      "identifier": "XML",
      "name": "XML",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=XML"
    },
    "7": {
      "@type": "SoftwareApplication",
      "identifier": "digest",
      "name": "digest",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=digest"
    },
    "8": {
      "@type": "SoftwareApplication",
      "identifier": "lgr",
      "name": "lgr",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=lgr"
    },
    "9": {
      "@type": "SoftwareApplication",
      "identifier": "dplyr",
      "name": "dplyr",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=dplyr"
    },
    "10": {
      "@type": "SoftwareApplication",
      "identifier": "jsonlite",
      "name": "jsonlite",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=jsonlite"
    },
    "SystemRequirements": null
  },
  "fileSize": "2231.762KB"
}

GitHub Events

Total
  • Issues event: 2
  • Push event: 21
  • Create event: 3
Last Year
  • Issues event: 2
  • Push event: 21
  • Create event: 3

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 36
  • Total pull requests: 3
  • Average time to close issues: 2 months
  • Average time to close pull requests: about 6 hours
  • Total issue authors: 5
  • Total pull request authors: 3
  • Average comments per issue: 1.28
  • Average comments per pull request: 1.67
  • Merged pull requests: 2
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 2
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 1
  • Pull request authors: 0
  • Average comments per issue: 0.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • kenarab (24)
  • leobelen (8)
  • hadley (2)
  • sckott (1)
  • wch (1)
Pull Request Authors
  • kenarab (1)
  • noamross (1)
  • schloerke (1)
Top Labels
Issue Labels
bug (9) enhancement (8) qa (8) ropensci (4) sources (2) licence (2) netlib (2) dmccooey (2) rr (2) R6 (2) travis (2) fulldb (1) communication (1) curation (1) package (1) geometry (1) build (1) polymake (1)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 740 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 1
  • Total versions: 19
  • Total maintainers: 1
cran.r-project.org: Rpolyhedra

Polyhedra Database

  • Versions: 19
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 740 Last month
Rankings
Forks count: 9.6%
Stargazers count: 15.1%
Average: 23.1%
Dependent repos count: 24.0%
Dependent packages count: 28.8%
Downloads: 37.9%
Maintainers (1)
Last synced: 6 months ago

Dependencies

DESCRIPTION cran
  • R >= 3.5.0 depends
  • R6 * imports
  • XML * imports
  • digest * imports
  • geometry * imports
  • git2r * imports
  • lgr * imports
  • rgl * imports
  • stringr * imports
  • codemetar * suggests
  • covr * suggests
  • dplyr * suggests
  • knitr * suggests
  • pkgdown * suggests
  • rmarkdown * suggests
  • testthat * suggests
.github/workflows/ci.yaml actions
  • actions/checkout v2 composite
  • codecov/codecov-action v2 composite
  • r-lib/actions/setup-pandoc v1 composite