8000 Review changes by schloerke · Pull Request #28 · ropensci/Rpolyhedra · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Review changes #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Feb 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .lintr
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
linters: with_defaults(
multiple_dots_linter = NULL,
camel_case_linter = NULL,
snake_case_linter, # do not allow snake case
camel_case_linter = NULL, # allow camel case
multiple_dots_linter, # do not allow dot sep
commented_code_linter = NULL, # comment code is ok
NULL
)
5 changes: 3 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Authors@R: c(
person("Leonardo","Belen",,"leobelen@gmail.com", c("aut","com","cph"))
)
Maintainer: Alejandro Baranek <abaranek@dc.uba.ar>
Description: A polyhedra database scraped from various sources as R6 objects and 'rgl' visualizing capabilities.
Description: A polyhedra database scraped from various sources as R6 objects and 'rgl' visualizing capabilities.
License: MIT + file LICENSE
Encoding: UTF-8
LazyData: true
Expand All @@ -20,11 +20,12 @@ Imports: futile.logger,
rgl,
stringr,
R6,
testthat,
testthat,
XML,
digest,
git2r
Collate:
'Rpolyhedra-package.R'
'polyhedra-lib.R'
'ledger-lib.R'
'db-lib.R'
Expand Down
15 changes: 15 additions & 0 deletions R/Rpolyhedra-package.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#' @details
#' A polyhedra database scraped from:
#' \itemize{
#' \item http://paulbourke.net/dataformats/phd/: PHD files as R6 objects and 'rgl'
#' visualizing capabilities. The PHD format was created to describe the geometric
#' polyhedra definitions derived mathematically <http://www.netlib.org/polyhedra/>
#' by Andrew Hume and by the Kaleido program of Zvi Har'El.
#' \item http://dmccooey.com/Polyhedra: Polyhedra text datafiles.
#' }
#'
#' @docType package
#' @aliases Rpolyhedra
#' @importFrom R6 R6Class
#' @importFrom futile.logger flog.info
"_PACKAGE"
3 changes: 2 additions & 1 deletion R/public-lib.R
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ scrapePolyhedraSources <- function(sources.config =
#'#search within the polyhedron names from all sources
#'cubes <- getAvailablePolyhedra(sources=available.sources,
#' search.string="cube")
#'cubes
getAvailableSources <- function(){
getPolyhedraObject()$getAvailableSources()
}
Expand Down Expand Up @@ -134,7 +135,7 @@ getAvailableSources <- function(){
#'#search within the polyhedron names
#'
#'cube <- getAvailablePolyhedra(sources="netlib",search.string="cube")

#'cube
getAvailablePolyhedra <- function(sources =
names(getPackageEnvir(".available.sources")),
search.string = NULL){
Expand Down
1 change: 0 additions & 1 deletion R/serialization-lib.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ convertDFToXML <- function(df, name, node) {
#' @return an XML document, ready to be converted to String with XML::saveXML()
#' @examples
#' #get the representation of a cube (netlib library)
#' library(Rpolyhedra)
#' XML::saveXML(polyhedronToXML(getPolyhedron("netlib", "cube")$state))
#'
#' @importFrom XML newXMLDoc
Expand Down
18 changes: 1 addition & 17 deletions R/zzz.R
Original file line number Diff line number Diff line change
@@ -1,24 +1,8 @@
#' Rpolyhedra
#'
#' polyhedra database
#'
#' A polyhedra database scraped from:
#' * http://paulbourke.net/dataformats/phd/: PHD files as R6 objects and 'rgl'
#' visualizing capabilities. The PHD format was created to describe the geometric
#' polyhedra definitions derived mathematically <http://www.netlib.org/polyhedra/>
#' by Andrew Hume and by the Kaleido program of Zvi Har'El.
#' * http://dmccooey.com/Polyhedra: Polyhedra text datafiles.
#'
#' @docType package
#' @name Rpolyhedra
#' @importFrom R6 R6Class
#' @importFrom futile.logger flog.info
#' @author Alejandro Baranek <abaranek@dc.uba.ar>, Leonardo Javier Belen <leobelen@gmail.com>

#' Executes code while loading the package.
#'
#' @param libname The library name
#' @param pkgname The package name
#' @noRd
.onLoad <- function(libname, pkgname) {

setPackageEnvir(variable.name = "RpolyhedraEnv", new.env())
Expand Down
31 changes: 18 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
# Rpolyhedra

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

| Release | Usage | Development |
<!-- Polyhedra database scraped from publically available sources using R6 objects and 'rgl' visualizing capabilities. -->

This package is a curation made based on the poly package found on http://www.netlib.org/polyhedra/ ([Original Help message](poly_original_help_message.html)), and the polyhedra database found on http://dmccooey.com/polyhedra, 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.
1. A database of the scraped polyhedra.
1. An R6 polyhedron representation with 'rgl' package visualizing capabilites.


| Release | Usage | Development |
|:--------|:------|:------------|
[![](https://badges.ropensci.org/157_status.svg)](https://github.com/ropensci/onboarding/issues/157)| [![minimal R version](https://img.shields.io/badge/R%3E%3D-3.4.0-blue.svg)](https://cran.r-project.org/) | [![Travis](https://travis-ci.org/qbotics/Rpolyhedra.svg?branch=master)](https://travis-ci.org/qbotics/Rpolyhedra) |
| [![](https://badges.ropensci.org/157_status.svg)](https://github.com/ropensci/onboarding/issues/157)| [![minimal R version](https://img.shields.io/badge/R%3E%3D-3.4.0-blue.svg)](https://cran.r-project.org/) | [![Travis](https://travis-ci.org/qbotics/Rpolyhedra.svg?branch=master)](https://travis-ci.org/qbotics/Rpolyhedra) |
| [![CRAN](http://www.r-pkg.org/badges/version/Rpolyhedra)](https://cran.r-project.org/package=Rpolyhedra) | | [![codecov](https://codecov.io/gh/qbotics/Rpolyhedra/branch/master/graph/badge.svg)](https://codecov.io/gh/qbotics/Rpolyhedra) |

# How to get started
Expand All @@ -17,12 +24,10 @@ install.packages("Rpolyhedra")
Install the R package using the following commands on the R console:

```R
install.packages(c("futile.logger", "rgl", "stringr", "R6", "testthat", "devtools"))
devtools::install_github("qbotics/Rpolyhedra")
devtools::install_github("qbotics/Rpolyhedra", build_opts = NULL)
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
Expand All @@ -32,9 +37,9 @@ To get started execute the following commands:
```R
# 1. Obtain 5 regular solids
polyhedra.2.draw <- getAvailablePolyhedra(source = "netlib")
polyhedra.2.draw <- polyhedra.2.draw %>%
polyhedra.2.draw <- polyhedra.2.draw %>%
filter(scraped.name %in%
c("tetrahedron", "octahedron", "cube",
c("tetrahedron", "octahedron", "cube",
"icosahedron", "dodecahedron"))

# 2. Setup colors and scales
Expand All @@ -54,14 +59,14 @@ 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)

# 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)",
Expand All @@ -71,13 +76,13 @@ for (i in seq_len(n)) {
}

```
## sources
## 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](http://www.netlib.org/poly2/readme) 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
Expand Down
38 changes: 38 additions & 0 deletions man/Rpolyhedra-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 0 additions & 31 deletions man/Rpolyhedra.Rd

This file was deleted.

1 change: 1 addition & 0 deletions man/getAvailablePolyhedra.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/getAvailableSources.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/polyhedronToXML.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0