Items tagged with plottools plottools Tagged Items Feed

So I have something like this:

> with(student);
> with(plots);
> with(plottools);
> with(DEtools);

I have simulated 50 trajectories of an ODE system, with  a command roughly like this:

myPlot :=
 seq( plots:-odeplot
    ( Sol(i)
    , [ u(t), r(t), q(t) ]
    , t = T .. 0                          ### Time Run Backwards
    , 'numpoints' = 2*abs(T)
    )


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...

I was recently looking at rotating a 3D plot, using plottools:-rotate, and noticed something inefficient.

In the past few releases of Maple, efficient float[8] datatype rtables (Arrays or hfarrays) can be used inside the plot data structure. This can save time and memory, both in terms of the users' creation and manipulation of them as well as in terms of the GUI's ability to use them for graphic rendering.

What I noticed is that, if one starts with a 3D plot data structure containing a float[8] Array in the MESH portion, then following application of plottools:-rotate a much less efficient list-of-lists is produced in the resulting structure.

Likewise, an effiecient float[8] Array or hfarray in the GRID portion of a 3D plot structure gets transformed by plottools:-rotate into an inefficient list-of-lists object in the MESH portion of the result. For example,

restart:

p:=plot3d(sin(x),x=-6..6,y=-6..6,numpoints=5000,style=patchnogrid,
          axes=box,labels=[x,y,z],view=[-6..6,-6..6,-6..6]):

seq(whattype(op(3,zz)), zz in indets(p,specfunc(anything,GRID)));
                            hfarray

pnew:=plottools:-rotate(p,Pi/3,0,0):

seq(whattype(op(1,zz)), zz in indets(pnew,specfunc(anything,MESH)));
                              list

The efficiency concern is not just a matter of the occupying space in memory. It also relates to the optimal attainable methods for subsequent manipulation of the data.

It may be nice and convenient for plottools to get as much mileage as it can out of plottools:-transform, internally. But it's suboptimal. And plotting is a topic where dedicated, optimized helper routines for some particular data format is justified and of merit. If we want plot manipulation to be fast, then both Library-side as well as GUI-side operations need more case-by-case-optimizated.

Here's an illustrative worksheet, using and comparing memory performance with a (new, alternative) procedure that does inplace rotation of a 3D MESH. plot3drotate.mw

The problem has been discussed in mapleprimes before, but I have not come across a neat solution. Perhaps there is one. What is the state of the art for exporting 3D graphics (plot3d, etc.) with Maple 15?

What I think I know is this: standard GUI has a completely new way of treating 2D graphics but has an outdated way of rendering 3D, while the classic GUI, though no longer developed, for some reason typically renders better 3D graphics.

I used to export graphics...

restart:with(MultiSeries):with(plots):

parvalues:={C=2.02,H_liq=8.74,R=22.11,R1=0.0006};

G:=R3*k*(1-R1)/(C*Pec_i);

F1:=1/(R*S+1-S);

F:=F1*(1-R*G*S);

F2:=Pec_i*F;

A1:=Theta0/C=(exp(F2*(1-S))-1)*(H_liq+1/(1-exp(-C/k*F2*(S))));

R3values:= [0,-1,-3,-4]; colours:= [red,blue,green,black]; display([seq(plottools[transform]( unapply([k, subs(parvalues, Pec_i = -20, R3=R3values[i], F2)], (k,S))) (implicitplot(subs(parvalues,Theta0=4,R3=R3values[i...

In part due to a large number of requests on MaplePrimes, the command ?plottools,getdata was added to Maple 15. This new command gives programmers a better way to access the internals of plots and do things with the data they contain.

I was trying to come up with something really fun to do with this command, and another recent obsession came to mind: the game Minecraft.  Minecraft is nice, since like Maple it is written in Java and runs on lots of platforms!  For the uninitiated, Minecraft is a a sort of mostly unstructured "sandbox" game. The player starts in alone in a procedurally generated landscape consisting of blocks. They player can collect blocks with their hands or with tools and they use them to build new things. The wide array of things that people create in Minecraft is staggering.

So, I thought I would write some commands to export 3D plots in Maple to block structures in Minecraft.

Page 1 of 1