## animation of 3D plot rotation

by: Maple 15

Suppose that you wish to animate the whole view of a plot. By whole view, I mean that it includes the axes and is not just a rotation of a plotted object such as a surface.

One simple way to do this is to call plots:-animate (or plots:-display on a list of plots supplied in a list, with its `insequence=true` option). The option `orientation` would contain the parameter that governs the animation (or generates the sequence).

But that entails recreating the same plot each time. The plot data might not even change. The key thing that changes is the ORIENTATION() descriptor within each 3d plot object in the reulting data structure. So this is inefficient in two key ways, in the worst case scenario.

1) It may even compute the plot's numeric results, as many times as there are frames in the resulting animation.

2) It stores as many instances of the grid of computed numeric data as there are frames.

We'd like to do better, if possible, reducing down to a single computation of the data, and a single instance of storage of a grid of data.

To keep this understandable, I'll consider the simple case of plotting a single 3d surface. More complicated cases can be handled with revisions to the techniques.

Avoiding problem 1) can be done in more than one way. Instead of plotting an expression, a procedure could be plotted, where that procedure has `option remember` so that it automatically stores computed results an immediately returns precomputed stored result when the arguments (x and y values) have been used already.

Another way to avoid problem 1) is to generate the unrotated plot once, and then to use plottools:-rotate to generate the other grids without necessitating recomputation of the surface. But this rotates only objects in the plot, and does alter the view of the axes.

But both 1) and 2) can be solved together by simply re-using the grid of computed data from an initial plot3d call, and then constructing each frame's plot data structure component "manually". The only thing that has to change, in each, is the ORIENTATION(...) subobject.

At 300 frames, the difference in the following example (Intel i7, Windows 7 Pro 64bit, Maple 15.01) is a 10-fold speedup and a seven-fold reduction is memory allocation, for the creation of the animation structure. I'm not inlining all the plots into this post, as they all look the same.

```restart:
P:=1+x+1*x^2-1*y+1*y^2+1*x*y:

st,ba:=time(),kernelopts(bytesalloc):

plots:-animate(plot3d,[P,x=-5..5,y=-5..5,orientation=[A,45,45],
axes=normal,labels=[x,y,z]],
A=0..360,frames=300);

time()-st,kernelopts(bytesalloc)-ba;

1.217, 25685408
```
```restart:
P:=1+x+1*x^2-1*y+1*y^2+1*x*y:

st,ba:=time(),kernelopts(bytesalloc):

g:=plot3d(P,x=-5..5,y=-5..5,orientation=[-47,666,-47],
axes=normal,labels=[x,y,z]):

plots:-display([seq(PLOT3D(GRID(op([1,1..2],g),op([1,3],g)),
remove(type,[op(g)],
specfunc(anything,{GRID,ORIENTATION}))[],
ORIENTATION(A,45,45)),
A=0..360,360.0/300)],
insequence=true);

time()-st,kernelopts(bytesalloc)-ba;

0.125, 3538296
```

By creating the entire animation data structure manually, we can get a further factor of 3 improvement in speed and a further factor of 3 reduction in memory allocation.

```restart:
P:=1+x+1*x^2-1*y+1*y^2+1*x*y:

st,ba:=time(),kernelopts(bytesalloc):

g:=plot3d(P,x=-5..5,y=-5..5,orientation=[-47,666,-47],
axes=normal,labels=[x,y,z]):

PLOT3D(ANIMATE(seq([GRID(op([1,1..2],g),op([1,3],g)),
remove(type,[op(g)],
specfunc(anything,{GRID,ORIENTATION}))[],
ORIENTATION(A,45,45)],
A=0..360,360.0/300)));

time()-st,kernelopts(bytesalloc)-ba;

0.046, 1179432
```

Unfortunately, control over the orientation is missing from Plot Components, otherwise such an "animation" could be programmed into a Button. That might be a nice functionality improvement, although it wouldn't be very nice unless accompanied by a way to export all a Plot Component's views to GIF (or mpeg!).

The above example produces animations each of 300 frames. Here's a 60-frame version:

## Surface fitting...

Hi!

I have seven curves (expressions) R:=f(x) for different value A.

1. How to Plot all curves on one 3D spece plot?
2. Hot to get (fit) surface equation R:=f(x,A) from all 2D curve?

wzel

## how to plot a 3d graph(phi)...

the question is

Consider the function φ(x, n) defined as

Define a functional operator “phi” in order to evaluate φ(x, n) when we enter the command phi(x,n);.

Use Maple to draw a surface plot of this function for x ∈ [0,20] and n ∈ [1,20]. Your plot should have axes displayed and be fully labelled and titled.

## How to draw several animated spheres?...

Hello, can you help me? I need to draw a simple model of solar system (9 planets around the sun). I tried to draw planets with

> a[1] := animate(implicitplot3d,

[

...

## How to plot a vertical plane with a curved top...

I tried this, but it doesn't seem to like having the x's and y's in the z range.

` implicitplot3d(x = 6, x = 1 .. 7, y = 2 .. 5, z = 0 .. (1/4)*(x-4)^2+(1/5)*(y-3)^2+10  , view = [0 .. 8, 0 .. 8, 0 .. 20], transparency = .5, style = hidden);%;Error, (in plots/iplot3d/implicit3d) bad range arguments x = 1 .. 7, y = 2 .. 5, z = 0 .. (1/4)*(x-4)^2+(1/5)*(y-3)^2+10`

I'm trying to plot a surface above the xy plane that looks like a solid,...

## Plot a surface on a circular domain...

How can I make the 3d plot of a function such as z = 4x^2 - y^2 so that only the part of the surface above the unit circle in the xy plane is shown?

## how do I plot two functions in one plot component ...

I am creating a maple document to display the tangent plane to a function. the resulting function and tangent plane are displayed in a plot component. The problem I am having is that I can display both the function and the tangent plant at the same time with the foloowing statements:

PlotSurfs := plot3d([Func,TanPln], x = Xo-DmX .. Xo+DmX, y = Yo-DmY .. Yo+DmY,axes=VarAxes,scaling=VarScl,orientation=[OrX,OrY,OrZ]);

DocumentTools[SetProperty](PlotWin, value, PlotSurfs);

## Creating a 2D plot from a 3D plot...

How would you transform a 3D plot structure into a 2D plot structure? I have in mind 1) creating a 3D plot with odeplot or with plot3d, 2) selecting (say) 4 orientations, 3) transforming each into a 2D plot, 4) exporting the 2D plots using the Standard GUI.

The reason behind my question is that the best-looking exported plots that I have been able to obtain with Maple are 2D plots exported as postscript with the Standard GUI. 3D plots don't look nearly as good when...

## Gridlines in 3d space

Maple

I was digging through my old worksheets and came across something I created for one of my projects I never finished or well am still intending to work on.  Anyways I had come across a plot created in Matlab and noticed Maple didn't have an option to create gridlines in the axis on a 3d plot like Matlab did (at least I think it was Matlab) in any case I tried to mimic the same thing in Maple as exactly as I could.  The below is the groundwork I came up with and I...

## New Generation CAE system for framed structures...

by: Maple

It would be good I hope to present symbolic-numeric CAE system for framed structures analysis.

It will be available soon as Preview version for enthusiasts

The main features are:

• One calculation act - all analytical dependencies.
• Fast designing process for structural systems in industry, consulting and design companies;
• Fastest parametric analysis of construction. New quality of designing in optimization tasks,...

## How to make axes thicker in 3d plots...

Is there a way to make the x, y and z axes thicker in 3d plots?

## Plot curve in 3D...

Hi! I need some help with a curve I'm trying to plot.

I'm asked to intersect the surface produced by f(x,y) with the plane z=1/4 and to plot the curve generated by the intersection (in 3D). I found how the curve looks like but I don´t know how to plot that in 3D.

## How can I create an ellipse and an ellipsoid?...

I need to create an ellipse and an ellipsoid (ellipse in 3D) through code. How would I be able to do this? Can someone please give me an example for each?

Also, I will need to create a line for an ellipse and a plane for an ellipsoid that intersect. Would I be able to find the intersecting points? Would I be able to find the function for the curve line that is created when a plane intersects an ellipsoid? Also, how would I find the surface area and volume...