bluegum

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

Scope

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.

convex hull in 3D is Delaunay surface

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.

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).

hull <- tri_graticule(xlim = c(100, 150),  hull = TRUE)
clear3d()
plot3d(hull, specular = "black")
rglwidget()

random points in hull mode

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.


hull <- hull_graticule(coords = geosphere::randomCoordinates(120))
clear3d()
plot3d(hull, specular = "black")
rglwidget()

direct creation of delaunay hull

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.

library(bluegum)
hull <- tri_graticule(hull =FALSE)
library(rgl)
clear3d();
plot3d(hull, alpha = 0.5, specular = "black")
rglwidget()

direct creation of quads on the sphere

The function quad_graticule() will produce a sphere or a portion of one using a quadmesh. The hull mode is not relevant with quad.

hull <- quad_graticule()
library(rgl)
clear3d();
plot3d(hull, alpha = 0.5, specular = "black")
rglwidget()


hull <- quad_graticule(ylim = c(-10, 30))
library(rgl)
clear3d();
plot3d(hull, alpha = 0.5, specular = "black")
rglwidget()

3. quadmesh+reproj direct from a raster

4. terrain relief on mesh (trivial)

5. image textures - mesh3d format (two-step indexing to 0,1)


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.