Dear list! Here is a simplified script for cone in RGL (from rgl demos). I would like to draw a truncated cone / frustum using RGL in R. Do you have any suggestion how to modify code? Thanks a lot, OV library(rgl) cone3d <- function(base=c(0,0,0), tip=c(0,0,1), rad=1, n=30) { ? ? trans <- diag(4) ? ? p1 <- c(0,1,0) ? ? p2 <- c(1,0,0) ? ? degvec <- seq(0, 2*pi,length = n+1)[-1] ? ? ecoord2 <- function(theta) {base + rad * (cos(theta) * p1 + sin(theta) * p2)} ? ? i <- rbind(1:n, c(2:n,1), rep(n+1, n)) ? ? v <- cbind(sapply(degvec, ecoord2), tip) ? ? i <- rbind(i, rep(n+1 ,n)) ? ? v <- cbind(v, base) ? ? i.x <- rbind(c(2:n, 1), 1:n, rep(n+2, n)) ? ? i.x <- ?rbind(i.x, rep(n+2, n)) ? ? i <- cbind(i, i.x) ? ? v <- rbind(v, rep(1, ncol(v))) ? ? return(rotate3d(qmesh3d(v, i), matrix=trans)) } ? ?? open3d() q1 <- cone3d(tip = c(0,0,2)) shade3d(q1, col = "green"); axes3d(c('x','y','z')); box3d()