On 6/7/2011 12:36 PM, Duncan Murdoch wrote:
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
OK, I don't exactly understand all the relationships among time (in
seconds) for par3dinterp() and duration
and fps for play3d() and movie3d(), but the following gave me *exactly*
what I was looking for: transitions
among 5 views, with pauses at each:
# define an order to show the views and basic times for each:
views <- list(M1, M3, M4, M5, M2)
times <- 5 * (seq_along(views)-1)
# add pauses; use linear interpolation in time
interp3d.fun <- par3dinterp( times=sort(c(times, times+2)),
userMatrix=rep(views, each=2), method="linear")
play3d( interp3d.fun, duration=2*60/5)
best,
-Michael
--
Michael Friendly Email: friendly AT yorku DOT ca
Professor, Psychology Dept.
York University Voice: 416 736-5115 x66249 Fax: 416 736-5814
4700 Keele Street Web: http://www.datavis.ca
Toronto, ONT M3J 1P3 CANADA
______________________________________________
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.