|
From: <pri...@gm...> - 2007-06-16 23:17:12
|
-------- Original-Nachricht -------- Datum: Sat, 16 Jun 2007 11:11:48 -0400 Von: "Gary Pajer" <gar...@gm...> An: "pri...@gm..." <pri...@gm...>, vis...@li... Betreff: Re: [Visualpython-users] how to visualize 3D surface? > 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 > arrays > are the same length. To help with that, add some print statements like > > phi = arange( , , ) > print phi.shape > theta = 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 = linspace( , , 20) > theta = 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 = N.linspace( , , ) > theta = 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" > functions > 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 yeh for real, that was a stupid mistake by myself by mixing up that arrange and linspace command. i think that was more an influence of my aggression that Vpython doesnt behave like I want it to do...;) nevertheless, I have tried that faces_heightfield.py examplle again, but still it doesnt draw my partial sphere. Bruce gave me the advice that the motiton of a gyro is also an axample prog in vpython. thats true and it also works good there with leaving the trail by the figure axis...I just thought with that partial sphere it gonna look a little more nice and should help to understand the motion of the top...okay, if this problem is too heavy...but I still have one or more week to solve this problem till I will speak about my project in front of some co-students. okay, if somebody has an idea...please reply. good night -philipp varso > 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 > top > > > > fixed in one point which is under the influence of gravitational > force > > > > (without a dissipative function...so the energy is constant). > > therefore > > > I > > > > have solved the Hamilton equations in python (ODEint). now I wanted > to > > > 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ört? > > > > 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 > path > > 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 > sitting > > all day long learning for physics > > -- > > Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten > > Browser-Versionen downloaden: http://www.gmx.net/de/go/browser > > -- GMX FreeMail: 1 GB Postfach, 5 E-Mail-Adressen, 10 Free SMS. Alle Infos und kostenlose Anmeldung: http://www.gmx.net/de/go/freemail |