The goal of bluegum is to get the simplest mesh creation for the R-global project and outline the space of tools that already exist.
Currently this stuff is scattered over a mess of my projects, gris, anglr, silicate, quadmesh, and it’s time to outline the bare essentials and just how powerful rgl (and some key friends) already are.
WIP
We will limit to visualizations that use a geocentric projection of the Earth’s surface - i.e. a globe.
Luckily this does allow us to visit a lot of options.
The tri_graticule() function can create an entire sphere or a portion of one and use the convex hull method or a Delaunay-triangulation algorithm directly.
In hull mode, this could be used for arbitrary locations on the sphere and works as well with a portion of the sphere but the hull will also wrap around the inside of the sliced sphere so it’s a different result.
library(bluegum)
hull <- tri_graticule(hull = TRUE)
library(rgl)
#clear3d();
#plot3d(hull, specular = "black")
#rglwidget()Make it more detailed so that individual faces aren’t so visible.
hull <- tri_graticule(n = 60 * c(1, 1/2), hull = TRUE)
library(rgl)
clear3d()
plot3d(hull, specular = grey(0.05))
rglwidget()If we ask for a partial sphere when it’s a hull, because the hull has to wrap around (well, you might want this but it’s not faceted on those internal sides).
This mode requires us to set the number of coordinates (not the number of faces in x/y) and allows input of points on the surface, or they are created randomly.
library(rgl)
hull <- hull_graticule(n_coords = 24)
clear3d()
plot3d(hull, specular = "black")
rglwidget()We can pass in a 2- or 3-column matrix of coordinates, with lon, lat, and elevation - 0 is used if elevation is not included.
If we only want a sector and not wrap we need to use a triangulation tool directly, without hull mode.
hull <- tri_graticule(xlim = c(100, 150), hull = FALSE)
clear3d()
plot3d(hull, specular = "black")
rglwidget()We probably can’t tell the difference, hull or otherwise.
The function quad_graticule() will produce a sphere or a portion of one using a quadmesh. The hull mode is not relevant with quad.
See Agafonkin for a parallel tool in JS: https://twitter.com/mourner/status/1176159651953594370
Please note that the ‘bluegum’ project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.