hypertidy/silicate

turn extents into quads

Opened this issue · 0 comments

I.e.

library(rgl)

source("https://raw.githubusercontent.com/hypertidy/pfft/master/R/extents.R")
library(silicate)
d <- extents(silicate::inlandwaters)
d$z <- runif(nrow(d))
reps <- rep(seq(1, nrow(d)*4, by = 4), each = 4)-1
xl <- c(1, 2, 2, 1) + reps
yl <- c(1, 1, 2, 2) + reps
avb <- rbind(x = as.vector(t(cbind(d$xmn, d$xmx)))[xl], 
             y = as.vector(t(cbind(d$ymn, d$ymx)))[yl], 
             z = rep(d$z, each = 4), 
             h = 1)

idx <- matrix(seq(1, nrow(d) * 4), 4)
mesh <- qmesh3d(avb, idx, meshColor = "faces")
mesh$material$color <- colourvalues::colour_values(d$z)
plot3d(mesh)
aspect3d(1, 1, 1)