6.37 animating [display3d] structures (26.7.95)

6.37.1 Kevin Dowling
6.37.2 Robert Israel
6.37.3 MR BOB G COLLINGS

6.37.1 Kevin Dowling

I am having trouble animating a series of plots[display3d] results and wonder if someone has a solution to this. I believe the problem is may be that animates is unable to animate a list of lists of display3d structures, but am not sure. Here’s the sequence of things that should illustrate the problem:

This plots a sphere and translates it by 10:

>sphereplot := a -> plot3d(rot(a, 
  [sin(p)*cos(t), sin(p)*sin(t), 10 - cos(p)]), 
  p = 0..Pi, t = 0..2*Pi, style = patch, scaling = constrained); 
 
        [Rot is a simple function I wrote that takes an input angle, 
        in degrees and a vector and rotates the object about the 
        origin by a.]
 

This plots a ’necklace’ of spheres:

>plots[display3d]({seq(sphereplot(Pi*30*post/180), post = 1..12)});
 

Now, I want to animate this to produce a spinning ’necklace’ to make it look like a set of orbiting spheres. I have tried many things, here are some related successes:

        This displays, each sphere in the necklace, one at a time, but 
        in a very strange order using the insequence option to 
        display3d: 
 
>plots[display3d]({seq(sphereplot(Pi*30*pos/180), pos = 1..12)}, 
insequence = true);
 
        This animates a single sphere orbiting the periphery of a 
        circle: 
 
>plots[animate3d]((rot(Pi*30*star/180, 
  [sin(p)*cos(t), sin(p)*sin(te), 10 - cos(p)]), p = 0..Pi, t = 0..2*Pi), 
  star = 1..12, frames = 20, scaling = constrained); 
 
        But I cannot animate the full necklace that is produced by the 
        plots[display3d] command that generates the necklace. For 
        example, this doesn't work: 
 
>plots[display3d](rollerplot(Pi*30*posi/180), posi = 1..12, insequence = true); 
Error, (in plot3d/options3d) unknown or bad optional argument, posi = 1 .. 12
 
 
        Another approach I tried was to individually generate each 
        intermediate position (five will suffice) and then provide a 
        list to plots[animate3d], like so: 
 
>plotframe1 := plots[display3d]({seq(sphereplot(Pi*30*pos/180), pos = 1..12)}): 
 
        ...and so on for each postion with a different argument to 
        sphereplot, this gives five 3d structures. Then I tried this 
        but this didn't work either: 
 
>plots[animate3d][plotframe1, plotframe2, plotframe3, plotframe4, plotframe5];
 

If somemone can see the fundamental flaw in trying to animate [display3d] outputs, please let me know - or better, if you know of a solution!

6.37.2 Robert Israel

You didn’t include your definition of "rot", so I don’t know how you want to rotate it. By the way, you shouldn’t use the name "sphereplot" which is a command in the "plots" package.

|>      This displays, each sphere in the necklace, one at a time, but 
|>      in a very strange order using the insequence option to 
|>      display3d: 
         
|> >plots[display3d]({seq(sphereplot(Pi*30*pos/180), pos = 1..12)}, 
|> insequence = true); 
It's in a strange order because you use a set rather than a list, and Maple can put sets in strange orders. Try 
 
>plots[display3d]([seq(sphereplot(Pi*30*pos/180), pos = 1..12)], 
insequence = true); 
 
|> But I cannot animate the full necklace that is produced by the 
|> plots[display3d] command that generates the necklace. For 
|> example, this doesn't work: 
         
|> >plots[display3d](rollerplot(Pi*30*posi/180), posi = 1..12, insequence = true); 
|> Error, (in plot3d/options3d) unknown or bad optional argument, posi = 1 .. 12
 

You didn’t say what "rollerplot" is. Is "posi=1..12" supposed to be an argument to "rollerplot"? Or should there be another "seq" in there? As it is, you have "posi=1..12" as an argument to "display3d", which of course doesn’t know what it’s supposed to do with that.

|> Another approach I tried was to individually generate each 
|> intermediate position (five will suffice) and then provide a 
|>      list to plots[animate3d], like so: 
         
|>plotframe1 := plots[display3d]({seq(sphereplot(Pi*30*pos/180), pos = 1..12)}): 
         
|>      ...and so on for each postion with a different argument to 
|>      sphereplot, this gives five 3d structures. Then I tried this 
|>      but this didn't work either: 
         
|>plots[animate3d][plotframe1, plotframe2, plotframe3, plotframe4, plotframe5];
 

Now I’m really confused! You’re not even putting the list in parentheses? And why did you switch to "animate3d"? That must be called as animate3d(F, x=x1..x2, y=y1..y2,t=t1..t2) where F is an expression (or set of expressions) in variables x,y and t. What would work is

> plots[display3d]([plotframe1, plotframe2, plotframe3, plotframe4, plotframe5], 
    insequence=true);
 

Of course you could define a command to generate the frames, and do something like

> plots[display3d]([ seq(plotframe(k), k=1..5) ], insequence=true); 
 
|> If somemone can see the fundamental flaw in trying to animate 
|> [display3d] outputs, please let me know - or better, if you know of a 
|> solution! Thank you.
 

There’s no fundamental flaw, it’s just a matter of being careful with your ()'s, []'s and {}'s.

6.37.3 MR BOB G COLLINGS

For this statement to animate in sequence you need a list rather than a set. i.e.

>plots[display3d]([seq(sphereplot(Pi*30*pos/180), pos = 1..12)], 
insequence = true);
 

Or on this one try

>plots[display3d]([plotframe1, plotframe2, plotframe3, plotframe4, 
plotframe5],insequence=true);