Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Manipulate is, of course, wonderful … but there are LOTS of examples that are simply far too computationally intensive to use live real-time animations for. In such case, one has to use pre-generated graphics. So, let us suppose we have something like:

ListAnimate[
 Table[Plot3D[Cos[x Sin[n y]], {x, 0, 2 Pi}, {y, 0, Pi}], {n, 1, 2, .1}]]

All fine. Then it starts playing … and you grab the plot, and rotate it … and Mma rotates ONE SINGLE plot … and leaves all the others images in the animation as they were … creating a visually absurd animation.

Suggestion: If a user rotates one plot in a grouped animation ... even if they pre-rendered … they should all rotate by the same amount … so the animation will still work as intended.

Any suggestions as to how to overcome this short-coming in the Mma 9 front-end user interface?

share|improve this question
2  
Related: mathematica.stackexchange.com/q/5375/131 –  Yves Klett Jul 19 '13 at 21:25
    
I seem to recall another question about rotating (two) graphics together, but I cannot find it. Does that sound familiar to anyone else? –  Mr.Wizard Jul 19 '13 at 21:33
2  
@Mr.Wizard this one? –  Kuba Jul 19 '13 at 21:40
    
@Kuba yes, I believe so; thanks! –  Mr.Wizard Jul 20 '13 at 3:46

2 Answers 2

You can create plots with Dynamic ViewMatrix components.

However, it cancels advantage of light 2D rendered graphics. But that's your wish, isn't it? Of course it is still better than dynamic updating whole Plots.

va = 60 Degree;
vp = {1, 1, 1};
vv = {0, 0, 1};
plot = Table[Plot3D[Cos[x Sin[n y]], {x, -1, 1}, {y, -1, 1},
              ImageSize -> 300, SphericalRegion -> True, PlotRange -> 1, 
              BoxRatios -> 1,
              ViewAngle -> Dynamic@va, ViewPoint -> Dynamic@vp, 
              ViewVertical -> Dynamic@vv],
            {n, 1, 2, .1}];

ListAnimate[plot]

enter image description here

share|improve this answer
    
That's a very clever suggestion ... but all the plots go a bit 'weird' after you grab one of them. I tried controlling this by setting BoxRatios -> {1, 1, 3}, which partly helped, but still compacted the resulting plots into a small box. –  wolfies Jul 19 '13 at 20:48
    
@wolfies I must admit I can not handle ViewMatrix :) take a look at an update. –  Kuba Jul 19 '13 at 21:00
    
@wolfies does putting Kuba's dynamic settings within the Manipulate help: ListAnimate[ Table[Plot3D[Cos[x Sin[n y]], {x, 0, 2 Pi}, {y, 0, Pi}, ViewAngle -> Dynamic@va, ViewPoint -> Dynamic@vp, ViewVertical -> Dynamic@vv], {n, 1, 2, .1}], Initialization :> (va = 60 Degree; vp = {1, 1, 1}; vv = {0, 0, 1};)] –  bobthechemist Jul 20 '13 at 2:46

The key is to separate the graphics from the view properties, each with its own Dynamic wrapper. That way the view properties are updated by the front end independently from the Graphics3D data being updated from the kernel.

This can't be done with ListAnimate (or at least I don't see how at this point). Every time a new graphic is presented by ListAnimate, the Dynamic view properties are recreated, interrupting the updating by the front end.

However, if we use Animate, we can update the graphics elements separately from the view options. This lets the view properties be updated continuously and the graphics rotate smoothly.

DynamicModule[{vp, vv, va, plots},
 va = 35 Degree;
 vp = {1.3, -2.4, 2};
 vv = {0, 0, 1};
 plots = Table[
    Plot3D[Cos[x Sin[n y]], {x, -1, 1}, {y, -1, 1}, 
      PlotRange -> {0, 1}, SphericalRegion -> True, 
      ViewAngle -> Dynamic@va, ViewPoint -> Dynamic@vp, 
      ViewVertical -> Dynamic@vv],
  {n, 1, 2, .1}];

 Animate[Graphics3D[Dynamic@First@plots[[n]], 
   Options@First@plots], {n, 1, Length@plots, 1}]
 ]

Mathematica graphics

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.