Skip to content

Conversation

kenarab
Copy link

@kenarab kenarab commented Jul 6, 2024

Using this function can include sample polyhedra from RGL package

render_snapshot(clear=TRUE)
montshadow = ray_shade(montereybay, zscale = 50, lambert = FALSE)
montamb = ambient_shade(montereybay, zscale = 50)
montereybay %>%
  sphere_shade(zscale = 10, texture = "imhof1") %>%
  add_shadow(montshadow, 0.5) %>%
  add_shadow(montamb, 0) %>%
  plot_3d(montereybay, zscale = 50, fov = 0, theta = -45, phi = 45,
          windowsize = c(1000, 800), zoom = 0.75,
          water = TRUE, waterdepth = 0, wateralpha = 0.5, watercolor = "lightblue",
          waterlinecolor = "white", waterlinealpha = 0.5)
shape.scale <- 100
set.seed(1833204)
material3d(color = c("yellow"), lit = TRUE, ambient = "#000020", alpha = 0.4)
render_shapelist3d(shapelist3d(icosahedron3d(), x = rnorm(5, mean = - shape.scale / 2, sd = shape.scale),
                               y = rnorm(5, mean = shape.scale, sd = shape.scale / 2),
                               z = rnorm(5, mean = 0, sd = shape.scale),
                               size = 10, plot = FALSE))

rayshaderMontereyBayIcosahedrons

An example for visualizing polyhedra from Rpolyhedra database

montshadow = ray_shade(montereybay, zscale = 50, lambert = FALSE)
montamb = ambient_shade(montereybay, zscale = 50)
montereybay %>%
    sphere_shade(zscale = 10, texture = "imhof1") %>%
    add_shadow(montshadow, 0.5) %>%
    add_shadow(montamb, 0) %>%
    plot_3d(montereybay, zscale = 50, fov = 0, theta = -45, phi = 45,
            windowsize = c(1000, 800), zoom = 0.75,
            water = TRUE, waterdepth = 0, wateralpha = 0.5, watercolor = "lightblue",
            waterlinecolor = "white", waterlinealpha = 0.5)
Sys.sleep(0.2)

# For using extended database have to switch to full database
#switchToFullDatabase()
geodesic.polyhedron <- getPolyhedron(source = "dmccooey",
              polyhedron.name = "geodesic icosahedron pattern 10 [5,0]")
stopifnot(!is.null(geodesic.polyhedron))
material3d(color = c("light blue"), lit = TRUE, ambient = "#000020", alpha = 0.4)
render_shapelist3d(shapelist3d(geodesic.polyhedron$getRGLModel(),
                               x = 70, y = 0,
                               z = -30, col = 2, alpha = 0.4, size = 100, plot = FALSE))

rayshaderRenderGeodesicDome

@kenarab
Copy link
Author

kenarab commented Jul 9, 2024

Improved examples code. Corrected devtools::check.

There are some windows issues seemly. Don't have now a windows machine available, I think it has not to do with the function added, but will check later this week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant