1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
"rgl.Map" <-
function(Map, which, ...) {
if (missing(which)) which <- TRUE
if(!requireNamespace('rgl', quietly = TRUE)) stop("This function depends on the 'rgl' package which is not available")
n1 <- length(Map[which])
for(i in seq_len(n1)) {
n2 <- length(Map[which][[i]])
for(j in seq_len(n2)) {
tmp <- Map[which][[c(i,j,1)]]
long <- tmp[,1] * pi/180
lat <- pi/2 - tmp[,2] * pi/180
z <- cos(long)*sin(lat)
y <- cos(lat)
x <- sin(long)*sin(lat)
rgl::lines3d(x,y,z, ...)
}
}
invisible()
}
|