|
From: Gary P. <gar...@gm...> - 2007-06-16 15:11:48
|
I see two problems right away, and one future difficulty [I'll continue to look at your problem later... I have other tasks to work on at the moment] 1.) theta and phi aren't the same length. It can be tricky to get arange() to produce arrays of the same length. The linspace() function is usually preferred, but linspace is not part of plain python or visual. It is part of numpy. You have two choices. Play around with arange() until the array= s are the same length. To help with that, add some print statements like phi =3D arange( , , ) print phi.shape theta =3D arange( , , ) print theta.shape then play with the third argument of arange() until the shapes are the same= . Your second option is to import numpy. You may have to install it. For installation instructions see http://numpy.scipy.org Then you will have linspace available: from numpy import * phi =3D linspace( , , 20) theta =3D linspace( , , 20) will insure that both arrays have 20 elements. Note: You should have no problems with the syntax above. However, it is considered poor python style to use "import *" as that form has the *potential* for overwriting previously written variable names. Better: import numpy as N # "N" can be any valid python variable name phi =3D N.linspace( , , ) theta =3D N.linspace( , , ) For short/simple programs it usually not an issue. *BUT* the current version of Vpython depends on an earlier version of numpy (Numeric). I worry slightly that importing numpy over Numeric might cause a problem. I may be being too cautious. 2.) Mesh() is not a python function. I think you probably already know that. Once you settle issue 1.) above, you should look at the example faces_cone.py for hints on how to proceed. Numpy does have "mesh" function= s that might do what you are trying to do ... if that approach is necessary. Future difficulty: Bruce says that transparency works only in the Linux beta version. I'm not sure how to deal with that. One idea is to make your faces thin, and your curves thick so that they would be seen from top or bottom. You would have to rotate the scene to see the top and the curve and the manifold. -gary On 6/16/07, pri...@gm... <pri...@gm...> wrote: > > -------- Original-Nachricht -------- > Datum: Sat, 16 Jun 2007 09:35:35 -0400 > Von: "Gary Pajer" <gar...@gm...> > An: "pri...@gm..." <pri...@gm...> > CC: vis...@li... > Betreff: Re: [Visualpython-users] how to visualize 3D surface? > > > If I understand correctly, you are drawing the path of the top of the > > sphere > > (using curve( ) ?) But you would also like to show the underlying > > manifold, > > the part of the sphere between theta_min and theta_max. > > > > Are you on Windows or Linux? I'll look more closely at your original > post > > now. > > > > How is the weather in Dresden? > > > > -gary > > > > On 6/16/07, pri...@gm... <pri...@gm...> wrote: > > > > > > well, I am trying to visualize the dynamics of a heavy symmetrical to= p > > > fixed in one point which is under the influence of gravitational forc= e > > > (without a dissipative function...so the energy is constant). > therefore > > I > > > have solved the Hamilton equations in python (ODEint). now I wanted t= o > > show > > > the dynamic of the figure axis of the top (which is the rotating > z-axis) > > > which should leaving a trail on a 2D-manifold. in this case it is a > part > > of > > > a sphere. The Euler angle Theta as a function of time is in this case > a > > > periodic function which oscillates between theta_max and theta_min. > > these > > > are the boundraries for my partial sphere. > > > > > > so I am depended on using Vpython if I want to draw this surface, > since > > i > > > want to show they dynamics of this top. i hope some of you understood > my > > > project...hopefully i will receive some help on this. thanks on that. > > > > > > greets from desden/germany > > > > > > -philipp > > > -- > > > Psssst! Schon vom neuen GMX MultiMessenger geh=F6rt? > > > Der kanns mit allen: http://www.gmx.net/de/go/multimessenger > > > > > > > > > ------------------------------------------------------------------------- > > > This SF.net email is sponsored by DB2 Express > > > Download DB2 Express C - the FREE version of DB2 express and take > > > control of your XML. No limits. Just data. Click to get it now. > > > http://sourceforge.net/powerbar/db2/ > > > _______________________________________________ > > > Visualpython-users mailing list > > > Vis...@li... > > > https://lists.sourceforge.net/lists/listinfo/visualpython-users > > > > > yes, you got it. i am using cruve(), to see which path the Euler Angle > Theta has taken (drawing the path of the figure axis of the top). this pa= th > lies on a surface of a sphere between those theta_max and theta_min...so = I > am trying to show the undrlying part of the sphere. > > i could plot a whole sphere, but then you arent able to see the rotating > top, just the path of Theta(time). So I wanted just to draw a part of the > sphere (2D-manifold)...thats it. I hope it won't be a problem that I am > working with windows at home, but at our university the system is linux. = so > I've got an alternative... > > -philipp varso > > PS: the weather is fine, but i dont have too much of it since I am sittin= g > all day long learning for physics > -- > Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten > Browser-Versionen downloaden: http://www.gmx.net/de/go/browser > |