-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
o Added argument 'class' for injecting a 'class' attribute to the
HTML canvas generated when RGL device is closed with devOffRGL(). o Added package vignette.
- Loading branch information
1 parent
1abb06f
commit d026342
Showing
9 changed files
with
177 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#########################################################################/** | ||
# @RdocPackage R.devices.rgl | ||
# | ||
# \description{ | ||
# @eval "getDescription(R.devices.rgl)" | ||
# } | ||
# | ||
# \section{To get started}{ | ||
# \itemize{ | ||
# \item Vignette '\href{../doc/index.html}{R.devices.rgl: Examples}' | ||
# \item @see "toWebGL" - evaluate graphics code and atomically save HTML WebGL code to file. | ||
# } | ||
# } | ||
# | ||
# \section{How to cite this package}{ | ||
# To cite this package, please use: | ||
# \preformatted{ | ||
# @eval "paste(capture.output(toBibtex(citation(package='R.devices.rgl'))), collapse='\n')" | ||
# } | ||
# } | ||
# | ||
# \author{ | ||
# @eval "packageDescription('R.devices.rgl')$Author". | ||
# } | ||
# | ||
# \section{License}{ | ||
# @eval "packageDescription('R.devices.rgl')$License". | ||
# } | ||
#*/######################################################################### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
## covr: skip=all | ||
|
||
.onLoad <- function(libname, pkgname) { | ||
ns <- getNamespace(pkgname) | ||
pkg <- Package(pkgname) | ||
assign(pkgname, pkg, envir=ns) | ||
} | ||
|
||
.onAttach <- function(libname, pkgname) { | ||
startupMessage(get(pkgname, envir=getNamespace(pkgname))) | ||
} | ||
|
||
|
||
############################################################################ | ||
# HISTORY: | ||
# 2015-02-03 | ||
# o Created. | ||
############################################################################ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
<%@meta language="R-vignette" content="-------------------------------- | ||
DIRECTIVES FOR R: | ||
|
||
%\VignetteIndexEntry{R.devices.rgl: Examples} | ||
%\VignetteAuthor{Henrik Bengtsson} | ||
%\VignetteKeyword{R} | ||
%\VignetteKeyword{RSP} | ||
%\VignetteKeyword{rgl} | ||
%\VignetteKeyword{WebGL} | ||
%\VignetteEngine{R.rsp::rsp} | ||
%\VignetteTangle{FALSE} | ||
--------------------------------------------------------------------"%> | ||
<% t0 <- Sys.time() %> | ||
<% R.rsp <- R.oo::Package("R.rsp") %> | ||
<% | ||
options("withCapture/newline"=FALSE) | ||
options(width=110L) | ||
library("R.utils") ## withCapture() | ||
library("R.devices") | ||
library("R.devices.rgl") | ||
useRGL(useNULL=TRUE) | ||
%> | ||
|
||
<%--- HTML <style> should really be in the <head> not <body> ---%> | ||
<style type="text/css"> | ||
.rglWebGL { | ||
margin-left: auto; | ||
margin-right: auto; | ||
display: block; | ||
border: solid 1px #cccccc; | ||
} | ||
</style> | ||
|
||
|
||
# <%@meta name="title"%> | ||
|
||
<%@meta name="author"%> on <%=format(as.Date(R.rsp$date), format="%B %d, %Y")%> | ||
|
||
```r | ||
<%=withCapture({ | ||
library('R.devices.rgl') | ||
})%> | ||
``` | ||
|
||
## Examples | ||
|
||
### Example: 3D scatter plot | ||
```r | ||
<%=withCapture({ | ||
x <- sort(rnorm(1000)) | ||
y <- rnorm(1000) | ||
z <- rnorm(1000) + atan2(x, y) | ||
})%> | ||
``` | ||
<%=toWebGL("plot3d", tags="example", { | ||
plot3d(x, y, z, col=rainbow(1000)) | ||
})%> | ||
|
||
|
||
### Example: 3D shapes | ||
This example is taken from the vignette of the [rgl] package. | ||
<%=toWebGL("shapes", tags="example", { | ||
layout3d(matrix(1:16, nrow=4, ncol=4), heights=c(1,3,1,3)) | ||
cols <- rainbow(7) | ||
text3d(0,0,0,"tetrahedron3d"); next3d() | ||
shade3d(tetrahedron3d(col=cols[1])); next3d() | ||
text3d(0,0,0,"cube3d"); next3d() | ||
shade3d(cube3d(col=cols[2])); next3d() | ||
text3d(0,0,0,"octahedron3d"); next3d() | ||
shade3d(octahedron3d(col=cols[3])); next3d() | ||
text3d(0,0,0,"dodecahedron3d"); next3d() | ||
shade3d(dodecahedron3d(col=cols[4])); next3d() | ||
text3d(0,0,0,"icosahedron3d"); next3d() | ||
shade3d(icosahedron3d(col=cols[5])); next3d() | ||
text3d(0,0,0,"cuboctahedron3d"); next3d() | ||
shade3d(cuboctahedron3d(col=cols[6])); next3d() | ||
text3d(0,0,0,"oh3d"); next3d() | ||
shade3d(oh3d(col=cols[7])) | ||
})%> | ||
|
||
|
||
## Appendix | ||
To install R.devices.rgl, do: | ||
```r | ||
source('http://callr.org/install#HenrikBengtsson/R.devices.rgl') | ||
``` | ||
|
||
[rgl]: http://cran.r-project.org/package=rgl |