generic TODO / explore list
Hawaii example
library(rangl)
library(raster)
library(marmap) ## has topo data
data(hawaii)
library(rgeos)
haw <- setExtent(raster(unclass(hawaii)), extent(unlist(lapply(attr(hawaii, "dimnames"), function(x) as.numeric(c(head(x, 1), tail(x, 1)))))))
projection(haw) <- "+proj=longlat +ellps=WGS84"
hpoly <- rasterToPolygons(cut(haw, c(cellStats(haw, min), 0, cellStats(haw, max))), dissolve = TRUE)
## just some polygons
hpoly <- rgeos::gPolygonize(rasterToContour(cut(haw, c(cellStats(haw, min), 0, cellStats(haw, max))), lev = 1.5))
plot(globe(rangl(haw * 280)))
rh <- rangl(hpoly)
rh$v$z_ <- 4e6
plot(globe(rh))
Geozoo has a bunch of interesting geometries, but not many have edges. You can use ball pivoting from vcg to some extent.
Good grist for rangl.
Mobius ribbon
library(geozoo)
m <- mobius()
library(rgl)
library(Rvcg)
e <- vcgBallPivoting(m$points)
shade3d(e)
Solid cube grid
a <- cube.solid.grid()
segments3d(a$points[t(a$edges), ])
Simplex
sp <- simplex(p = 3)
segments3d(sp$points[t(as.matrix(sp$edges)), ])
Shell
https://www.linkedin.com/pulse/hermit-crab-gets-3d-printed-designer-shell-modeled-using-jose-i-rey?trk=prof-post
needs a bit to be done properly, including some additions to quadmesh
M <- expand.grid(x = seq(0, 2*pi, length.out = 150),
y = seq(-pi/2, 5.33 *pi/2, length.out = 150))
r <- raster::rasterFromXYZ(cbind(M, 0))
qm <- quadmesh::quadmesh(r)
M <- expand.grid(x = seq(0, 2*pi, length.out = 151),
y = seq(-pi/2, 5.33 *pi/2, length.out = 151))
U <- M$x
V <- M$y
x <- 10 * 1.2^V*(sin(U)^8 * sin(V))
y <- 8 * 1.2^V*(sin(U)^2 * cos(V))
z <- 10 * 1.2^V * (sin(U - 0.4) * cos(U + 0.4))
qm$vb[1:3, ] <- t(cbind(x, y, z))
shade3d(qm, col = "chocolate", alpha = 0.2)
http://gmsh.info/doc/texinfo/gmsh.html
rgl needs ascii read for STL, see demos/sphere-surf.stl explore .geo format
A geographic example using gmsh in python is here: https://github.com/ccorail/qgis-gmsh/wiki
- TIN from raster http://blog.thematicmapping.org/2016/09/creating-tins-in-saga-gis.html
- Whuber's manifesto: http://www.quantdec.com/misc/Avencia.pdf
- igraph http://blog.ryanwalker.us/2014/03/going-viral-with-rs-igraph-package.html?m=1
- NASA models https://github.com/nasa/NASA-3D-Resources
Is it worth using triangles as per polyggon to do this?
http://gis.stackexchange.com/questions/224035/how-to-create-a-crisp-topographical-terrain-map-with-ggplot2
the triangles in RSTudio problem: https://github.com/mdsumner/gris/issues/1
Lake Superior, fuse poygons and raster
u <- "https://www.ngdc.noaa.gov/mgg/greatlakes/superior/data/geotiff/superior_lld.geotiff.tar.gz"
tf <- tempdir()
download.file(u, file.path(tf, basename(u)), mode = "wb")
untar(file.path(tf, basename(u)), exdir = tf)
r <- raster::raster(file.path(tf, "superior_lld", "superior_lld.tif"))
rgl::rgl.clear(); plot(anglr(st_transform(sfdct::lakesuperior, 4326), z = r)); rgl::aspect3d(1, 1, 0.1); rgl::rglwidget()
Can we wrap this http://www.cs.unc.edu/~isenburg/sd/
fkn a http://www.soilinfo.psu.edu/index.cgi?soil_data&conus&data_cov&poros&datasets&lam
deck.gl with textures in sight
https://github.com/uber/deck.gl/issues/632
elevation wind layers example referred to is https://github.com/uber/deck.gl/blob/0941bdb965e9e599dc850f1f40bce4f167ef6abb/showcases/wind/src/layers/elevation-layer/elevation-layer.js#L31
https://CRAN.R-project.org/package=tcie