On 12/04/2014, 11:19 AM, Roland Rau wrote:
Dear all,

I am using package rgl and I want to change the position where I "stand".
Maybe a small example might clarify what I am looking for:


# Begininng of explanatory example
library(rgl)
data(volcano)

# the example ?rgl.surface
y <- 2 * volcano
x <- 10 * (1:nrow(y))
z <- 10 * (1:ncol(y))
ylim <- range(y)
ylen <- ylim[2] - ylim[1] + 1
colorlut <- terrain.colors(ylen)
col <- colorlut[ y-ylim[1]+1 ]

rgl.open()
rgl.surface(x, z, y, color=col, back="lines")
## now I have the nice volcano surface
## with rgl.viewpoint I can change the elevation
## and the angle from where I look at the rgl.surface
# example of ?rgl.viewpoint
start <- proc.time()[3]
while ((i <- 36*(proc.time()[3]-start)) < 360) {
   rgl.viewpoint(i,i/4);
}
# End of explanatory example

What I am looking for (in this example) would be a way for me to "stand"
on the crater of the volcano, looking in a specific direction. Is there
something like a function where I can specify my coordinates (x,y,z) and
angle and a zoom factor?

I think you could hack something like that (see the description in ?par3d of how rendering is accomplished), but there's currently no support for it, and it wouldn't be easy, as currently P and M in that description are read-only quantities computed indirectly. So you'd have to essentially trick rgl into producing the P matrix corresponding to the viewing position you want.

I am currently working on some changes that might make this easier, but they likely aren't going to be released for several months.

Duncan Murdoch

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to