Skip to content

Commit

Permalink
detail in doc
Browse files Browse the repository at this point in the history
  • Loading branch information
stla committed Jun 30, 2023
1 parent 50e47d2 commit 761b484
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 14 deletions.
4 changes: 2 additions & 2 deletions .Rprofile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ dllunload <- function(){
}

myinstall <- function() {
dllunload()
try(dllunload())
if(rstudioapi::isAvailable()) {
rstudioapi::restartSession(
"devtools::install(quick = TRUE, keep_source = TRUE)"
Expand All @@ -18,7 +18,7 @@ myinstall <- function() {
mydocument <- function() {
if(rstudioapi::isAvailable()) {
rstudioapi::restartSession(
"roxygen2::roxygenise(load_code = roxygen2::load_installed)"
"roxygen2::roxygenise(load_code = roxygen2::load_installed)"
)
} else {
roxygen2::roxygenise(load_code = roxygen2::load_installed)
Expand Down
20 changes: 14 additions & 6 deletions R/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
return(list(vertices = Vertices, edges = Edges, triangles = Triangles))
}

#' @title Hyperbolic convex hull
#' @title Plot hyperbolic convex hull
#' @description Plot the hyperbolic convex hull of a set of 3D points.
#'
#' @encoding UTF-8
Expand Down Expand Up @@ -150,14 +150,22 @@
#' plotGyrohull3d(vertices, s)}
#'
#' # an example of color palette ####
#' library(trekcolors)
#' library(uniformly)
#' set.seed(666)
#' points <- runif_on_sphere(50, d = 3)
#' if(require("trekcolors")) {
#' pal <- trek_pal("lcars_series")
#' } else {
#' pal <- hcl.colors(32L, palette = "Rocket")
#' }
#' set.seed(666) # 50 random points on sphere
#' if(require("uniformly")) {
#' points <- runif_on_sphere(50L, d = 3L)
#' } else {
#' points <- matrix(rnorm(50L * 3L), nrow = 50L, ncol = 3L)
#' points <- points / sqrt(apply(points, 1L, crossprod))
#' }
#' \donttest{open3d(windowRect = c(50, 50, 562, 562))
#' plotGyrohull3d(
#' points, edgesColor = "brown",
#' facesColor = trek_pal("lcars_series"), g = function(u) 1-u^2
#' facesColor = pal, g = function(u) 1-u^2
#' )}
plotGyrohull3d <- function(
points, s = 1, model = "U", iterations = 5, n = 100, edgesAsTubes = TRUE,
Expand Down
29 changes: 29 additions & 0 deletions inst/essais/pentagrammicDipyramid.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
library(AlphaHull3D)
library(rgl)

rho <- sqrt((5 - sqrt(5))/10)
vs1 <- t(vapply(0:4, function(i){
c(rho*cos(2*i*pi/5), rho*sin(2*i*pi/5), 0)
}, numeric(3L)))
R <- sqrt((25 - 11*sqrt(5))/10)
vs2 <- t(vapply(0:4, function(i){
c(R*cos(2*i*pi/5 + pi/5), R*sin(2*i*pi/5 + pi/5), 0)
}, numeric(3L)))
pts <- rbind(vs1, vs2, c(0, 0, 0.1), c(0, 0, -0.1))



ahull <- fullAhull3d(pts)
mesh <- setAlpha(ahull, alpha = 0.2)
mesh$normals <- NULL

open3d(windowRect = c(50, 50, 512, 512))
view3d(15, -15, zoom = 0.7)
shade3d(mesh, color = "darkorange")
wire3d(mesh)

library(gyro)
open3d(windowRect = 50 + c(0, 0, 512, 512))
view3d(15, 15, zoom = 0.85)
plotGyroMesh(mesh, s = 0.2, tubesRadius = 0.005, spheresRadius = 0.01)

20 changes: 14 additions & 6 deletions man/plotGyrohull3d.Rd

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

0 comments on commit 761b484

Please sign in to comment.