Skip to content

Instantly share code, notes, and snippets.

@mdsumner
Created May 23, 2020 03:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mdsumner/75bbdd7aea552d8843866ccbadd63a2b to your computer and use it in GitHub Desktop.
Save mdsumner/75bbdd7aea552d8843866ccbadd63a2b to your computer and use it in GitHub Desktop.
  library(anglr)
  dem <- gebco
  mesh <- as.mesh3d(dem, triangles = FALSE)
  mesh$material$color <- colourvalues::colour_values(mesh$vb[3, ]); mesh$meshColor <- "vertices"
  plot3d(mesh)
  rgl::aspect3d(1, 1, .1)
  
  
  ## surface3d way
  library(raster)  ## don't @me give me a reprex with x, y vectors and a z matrix ;)
  z <- t(as.matrix(dem))
  x <- xFromCol(dem)
  y <- yFromRow(dem)
  
  surface3d(x, y, z, col = colourvalues::colour_values(z, "magma"))
  
  
@mdsumner
Copy link
Author

image

@mdsumner
Copy link
Author

  
  z <- matrix(c(1:5, 4:1), 3)
  x <- 1:3
  y <- 1:3
  open3d()
  surface3d(x, y, z, col = viridis::viridis(9)[z])
  wire3d(as.mesh3d(raster(list(x = x, y = y, z = z)), triangles = FALSE))
  aspect3d(1, 1, .2)
  

pixel vs. point

image

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