Build a “quadmesh” in R.
## Loading required package: sp
data(volcano)
volcano <- volcano[seq(1, nrow(volcano), by = 3), seq(1, ncol(volcano), by = 3)]
r <- setExtent(raster(volcano), extent(0, 100, 0, 200))
qm <- quadmesh(r)
library(rgl)
scl <- function(x) (x - min(x))/diff(range(x))
shade3d(qm, col = grey(scl(qm$vb[3,qm$ib])))
rglwidget()
A “quadmesh” is a dense mesh describing a topologically continuous surface of 4-corner primitives. I.e. a grid, without the “regular”. This is useful particularly when combined with map projections and texture mapping.
We are not limited to a regular grid, trivially let’s distort the mesh by a weird scaling factor.
The topology of the grid is still sound, but we are no longer bound to the regular constraint.
## null
## 3