Skip to main content
Tweeted twitter.com/StackMma/status/1043334899867033600
added 45 characters in body
Source Link
Szabolcs
  • 236.5k
  • 31
  • 641
  • 1.3k

3D graphics can be easily rotated interactively by clicking and dragging with the mouse.

Is there a simple way to achieve the same for animated 3D graphics? I would like to rotate them whileinteractively (in real time) while the animation is running.


Here's an example animation, mostly taken from the documentation.

L = 4;
sol = NDSolveValue[{D[u[t, x, y], t, t] == 
     D[u[t, x, y], x, x] + D[u[t, x, y], y, y] + Sin[u[t, x, y]], 
    u[t, -L, y] == u[t, L, y], u[t, x, -L] == u[t, x, L], 
    u[0, x, y] == Exp[-(x^2 + y^2)], 
    Derivative[1, 0, 0][u][0, x, y] == 0}, 
   u, {t, 0, L/2}, {x, -L, L}, {y, -L, L}];

Animate[
 Plot3D[sol[t, x, y], {x, -L, L}, {y, -L, L}, PlotRange -> {0, 1}, 
  PlotPoints -> 20, MaxRecursion -> 0],
 {t, 0, L/2}
 ]

When the animation is stopped, I can rotate the graphics. Then if the animation is started again, the rotation is kept.

However, I cannot rotate while the animation is running. Is there a relatively easy way to enable this?

Note: My actual application has an animated plot on the surface of a sphere. The ability to rotate would be very useful.

3D graphics can be easily rotated by clicking and dragging with the mouse.

Is there a simple way to achieve the same for animated 3D graphics? I would like to rotate them while the animation is running.


Here's an example animation, mostly taken from the documentation.

L = 4;
sol = NDSolveValue[{D[u[t, x, y], t, t] == 
     D[u[t, x, y], x, x] + D[u[t, x, y], y, y] + Sin[u[t, x, y]], 
    u[t, -L, y] == u[t, L, y], u[t, x, -L] == u[t, x, L], 
    u[0, x, y] == Exp[-(x^2 + y^2)], 
    Derivative[1, 0, 0][u][0, x, y] == 0}, 
   u, {t, 0, L/2}, {x, -L, L}, {y, -L, L}];

Animate[
 Plot3D[sol[t, x, y], {x, -L, L}, {y, -L, L}, PlotRange -> {0, 1}, 
  PlotPoints -> 20, MaxRecursion -> 0],
 {t, 0, L/2}
 ]

When the animation is stopped, I can rotate the graphics. Then if the animation is started again, the rotation is kept.

However, I cannot rotate while the animation is running. Is there a relatively easy way to enable this?

Note: My actual application has an animated plot on the surface of a sphere. The ability to rotate would be very useful.

3D graphics can be easily rotated interactively by clicking and dragging with the mouse.

Is there a simple way to achieve the same for animated 3D graphics? I would like to rotate them interactively (in real time) while the animation is running.


Here's an example animation, mostly taken from the documentation.

L = 4;
sol = NDSolveValue[{D[u[t, x, y], t, t] == 
     D[u[t, x, y], x, x] + D[u[t, x, y], y, y] + Sin[u[t, x, y]], 
    u[t, -L, y] == u[t, L, y], u[t, x, -L] == u[t, x, L], 
    u[0, x, y] == Exp[-(x^2 + y^2)], 
    Derivative[1, 0, 0][u][0, x, y] == 0}, 
   u, {t, 0, L/2}, {x, -L, L}, {y, -L, L}];

Animate[
 Plot3D[sol[t, x, y], {x, -L, L}, {y, -L, L}, PlotRange -> {0, 1}, 
  PlotPoints -> 20, MaxRecursion -> 0],
 {t, 0, L/2}
 ]

When the animation is stopped, I can rotate the graphics. Then if the animation is started again, the rotation is kept.

However, I cannot rotate while the animation is running. Is there a relatively easy way to enable this?

Note: My actual application has an animated plot on the surface of a sphere. The ability to rotate would be very useful.

Source Link
Szabolcs
  • 236.5k
  • 31
  • 641
  • 1.3k

Conveniently rotate animated 3D graphics

3D graphics can be easily rotated by clicking and dragging with the mouse.

Is there a simple way to achieve the same for animated 3D graphics? I would like to rotate them while the animation is running.


Here's an example animation, mostly taken from the documentation.

L = 4;
sol = NDSolveValue[{D[u[t, x, y], t, t] == 
     D[u[t, x, y], x, x] + D[u[t, x, y], y, y] + Sin[u[t, x, y]], 
    u[t, -L, y] == u[t, L, y], u[t, x, -L] == u[t, x, L], 
    u[0, x, y] == Exp[-(x^2 + y^2)], 
    Derivative[1, 0, 0][u][0, x, y] == 0}, 
   u, {t, 0, L/2}, {x, -L, L}, {y, -L, L}];

Animate[
 Plot3D[sol[t, x, y], {x, -L, L}, {y, -L, L}, PlotRange -> {0, 1}, 
  PlotPoints -> 20, MaxRecursion -> 0],
 {t, 0, L/2}
 ]

When the animation is stopped, I can rotate the graphics. Then if the animation is started again, the rotation is kept.

However, I cannot rotate while the animation is running. Is there a relatively easy way to enable this?

Note: My actual application has an animated plot on the surface of a sphere. The ability to rotate would be very useful.