On 07/06/2011 12:22 PM, Michael Friendly wrote:
On 6/7/2011 10:52 AM, Duncan Murdoch wrote:
Something like this works:
play3d(par3dinterp(times=c(0,5,6,11,12,17),
userMatrix=list(m1,m1,m2,m2,m3,m3),
method="linear"))
The "linear" says to use linear interpolation between time points, so
it will stay exactly constant when the userMatrix doesn't change. If
you leave it out, it uses spline interpolation, and that gives some
irritating overshooting.
Thanks very much for this, Duncan.
Something like this would make an excellent documentation example for
play3d/movie3d, or perhaps better
par3dinterp, even under \dontrun{}.
I take it that the times are relative rather than absolute, and time is
scaled according to duration and
fps when the scene is play3d()'d. Yes? If so, the description for
time= could also be clarified.
Definitely it should be clarified in the docs; they are absolute
times, in units of seconds. Things get a little complicated when you
go past the last time (17 seconds): there are a number of different
extrapolation methods described in ?par3dinterp.
What the par3dinterp function returns is a function that takes a time
(expressed in seconds) and computes the parameters (i.e. the
userMatrix in the example) that should be in effect at that time. It
doesn't know anything about fps, that's used by play3d to choose what
times to pass to that constructed function. The function that play3d
is given can do lots of things other than returning new viewpoint
parameters; for example, the flag demo redraws the scene in every
frame (using skipRedraw=TRUE to avoid showing partial versions).
Duncan