Description Usage Arguments Details Value Author(s) See Also Examples
Spins the current rgl window with constant increment(s) in theta and/or phi.
Use <ESC>
in the R window to stop.
1 |
inc.theta |
Increment for rotation about the vertical, |
inc.phi |
Increment for rotation around the |
theta |
Initial value for |
phi |
Initial value for |
TBW
None
Georges Monette
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 26 27 28 29 30 31 32 33 34 35 36 37 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function( inc.theta = 1/4, inc.phi = 0, theta = NULL, phi = NULL) {
help = "
Spins the current rgl window with a constant increment in theta and phi.
Use ESC in R window to stop.
BUG: - Respects some mouse motions but behaves unpredictably.
- Should have a better way to stop
"
um <- par3d('userMatrix')
Acos = function(x) 360*acos(x)/(2*pi)
Asin = function(x) 360*asin(x)/(2*pi)
Atan2 = function( s, c) atan2( s, c)*(180/pi)
theta.phi = function( ) {
par3d()
um = par3d('userMatrix')
list(theta = Atan2(-um[1,3], um[1,1]), phi = Atan2 (um[3,2],um[2,2]))
}
tp = theta.phi()
if(is.null(theta)) theta = tp$theta
if(is.null(phi)) phi = tp$phi
while(TRUE) {
theta = (theta + inc.theta) %% 360
phi = phi + inc.phi
spin( theta = theta , phi = phi)
tp = theta.phi()
# print( tp )
theta = tp$theta
phi = tp$phi
}
invisible(NULL)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.