|
From: <pri...@gm...> - 2007-06-14 18:45:52
|
hi folks, I am new to VPython so this question may sound a little bit naive; I've got a question concerning the problem how to visiualize a 2D-manifold in Vypthon. In this special case, the parameters are Theta and Phi to just plot a part of the surface of a sphere, where the Radius is constant. An additional feature would be that the surface is something like transparent or it also could be a spherical grid. I hope my english is not too bad, so that some of you could understand what my problem currently is. I hope I'll receive any help soon. Thank you very much. greets from germany -Philipp -- GMX FreeMail: 1 GB Postfach, 5 E-Mail-Adressen, 10 Free SMS. Alle Infos und kostenlose Anmeldung: http://www.gmx.net/de/go/freemail |
|
From: <pri...@gm...> - 2007-06-15 18:52:16
|
hi folks, I am new to VPython so this question may sound a little bit naive; I've got a question concerning the problem how to visiualize a 2D-manifold in Vypthon. In this special case, the parameters are Theta and Phi to just plot a part of the surface of a sphere, where the Radius is constant. An additional feature would be that the surface is something like transparent or it also could be a spherical grid. I hope my english is not too bad, so that some of you could understand what my problem currently is. I hope I'll receive any help soon. Thank you very much. greets from germany -Philipp > You might study the example program faces_heightfield.py that comes with > VPython, as it creates a surface. > > The most general VPython object is "faces" which lets you display > arbitrary triangles and specify lighting at vertices. This low-level > object could be used to display a portion of a sphere. Or if you want to > display a portion of a sphere as a grid, use the "curve" object. > > There exists a beta version of VPython which lets you specify that an > object is transparent. See the "Recent developments" section of > vpython.org. Unfortunately the Windows version has some serious bugs > (see the documentation in the Recent developments section) and there is > no Macintosh version. The Linux version mostly works correctly. > > Bruce Sherwood > > pri...@gm... wrote: > > hi folks, > > > > I am new to VPython so this question may sound a little bit naive; > > I've got a question concerning the problem how to visiualize a > 2D-manifold in Vypthon. In this special case, the parameters are Theta and Phi to > just plot a part of the surface of a sphere, where the Radius is constant. An > additional feature would be that the surface is something like transparent > or it also could be a spherical grid. I hope my english is not too bad, so > that some of you could understand what my problem currently is. I hope > I'll receive any help soon. > > > > Thank you very much. > > > > greets from germany > > > > -Philipp > > thx for the fast post. just like you recommanded, i have studied this example, and also tried to plot my surface. but this heightfiled_faces.py example comes a little bit complicated and it also doesn't do that what I expected. i need to add that I am new to python and I just wonder that it doesn't seem to be easy to plot a 3D-surface (just like in mathematica for example). nevertheless, I would truly like to understand this example programm, and also what I made wrong in useage; here are the differences to the example prog: ############################ theta = arange(0,pi/2.0,2./20) phi= arange(0,2.0*pi,2./20) x = sin(theta)*cos(phi) y = sin(theta)*sin(phi) m = Mesh( x, sqrt(1.0 - (x**2.0 + y**2.0)), y) ############################ when I try to run faces_heightfield.py with these modifications, "frames are not aligned" occurs. maybe somebody could help me with this problem, I would truly appreciate it....Thank you very much. -phil -- Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kanns mit allen: http://www.gmx.net/de/go/multimessenger |
|
From: Bruce S. <Bru...@nc...> - 2007-06-15 19:34:48
|
Sorry, but I'm swamped with other work and can't help with Python coding. Maybe someone else will give you some help. The "frames not aligned" sounds like maybe the problem could be that you can't add x**2 and y**2 because these two arrays don't have the same lengths. Bruce Sherwood pri...@gm... wrote: > hi folks, > > I am new to VPython so this question may sound a little bit naive; > I've got a question concerning the problem how to visiualize a 2D-manifold in Vypthon. In this special case, the parameters are Theta and Phi to just plot a part of the surface of a sphere, where the Radius is constant. An additional feature would be that the surface is something like transparent or it also could be a spherical grid. I hope my english is not too bad, so that some of you could understand what my problem currently is. I hope I'll receive any help soon. > > Thank you very much. > > greets from germany > > -Philipp > > >> You might study the example program faces_heightfield.py that comes with >> VPython, as it creates a surface. >> >> The most general VPython object is "faces" which lets you display >> arbitrary triangles and specify lighting at vertices. This low-level >> object could be used to display a portion of a sphere. Or if you want to >> display a portion of a sphere as a grid, use the "curve" object. >> >> There exists a beta version of VPython which lets you specify that an >> object is transparent. See the "Recent developments" section of >> vpython.org. Unfortunately the Windows version has some serious bugs >> (see the documentation in the Recent developments section) and there is >> no Macintosh version. The Linux version mostly works correctly. >> >> Bruce Sherwood >> >> pri...@gm... wrote: >> >>> hi folks, >>> >>> I am new to VPython so this question may sound a little bit naive; >>> I've got a question concerning the problem how to visiualize a >>> >> 2D-manifold in Vypthon. In this special case, the parameters are Theta and Phi to >> just plot a part of the surface of a sphere, where the Radius is constant. An >> additional feature would be that the surface is something like transparent >> or it also could be a spherical grid. I hope my english is not too bad, so >> that some of you could understand what my problem currently is. I hope >> I'll receive any help soon. >> >>> Thank you very much. >>> >>> greets from germany >>> >>> -Philipp >>> >>> > > thx for the fast post. just like you recommanded, i have studied this example, and also tried to plot my surface. but this heightfiled_faces.py example comes a little bit complicated and it also doesn't do that what I expected. i need to add that I am new to python and I just wonder that it doesn't seem to be easy to plot a 3D-surface (just like in mathematica for example). nevertheless, I would truly like to understand this example programm, and also what I made wrong in useage; here are the differences to the example prog: > > ############################ > theta = arange(0,pi/2.0,2./20) > phi= arange(0,2.0*pi,2./20) > x = sin(theta)*cos(phi) > y = sin(theta)*sin(phi) > > m = Mesh( x, sqrt(1.0 - (x**2.0 + y**2.0)), y) > ############################ > > when I try to run faces_heightfield.py with these modifications, "frames are not aligned" occurs. maybe somebody could help me with this problem, I would truly appreciate it....Thank you very much. > > -phil > > > |
|
From: <pri...@gm...> - 2007-06-16 12:53:56
|
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 |
|
From: Gary P. <gar...@gm...> - 2007-06-16 13:42:00
|
<vis...@li...> If I understand correctly, you are drawing the path of the top of the spher= e (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 sh= ow > 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 > |
|
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 > |
|
From: Bruce S. <Bru...@nc...> - 2007-06-16 16:37:11
|
I didn't say quite that transparency only works in the beta version for Linux. Transparency DOES work in the beta version for Windows. Rather the issue is that the Windows beta version is buggy in various ways (not transparency), and this version is not ready for routine production use. Bruce Sherwood Gary Pajer wrote: > > 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 > |
|
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 |
|
From: Bruce S. <Bru...@nc...> - 2007-06-16 23:57:43
|
One thing you could do is simply use curve to superimpose some "longitude" and "latitude" lines in the gyro2.py program, so that the trajectory of the end of the gyroscope axis would visibly be on a spherical surface. Bruce Sherwood pri...@gm... wrote: > > 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 > > > |
|
From: Bruce S. <Bru...@nc...> - 2007-06-16 16:34:14
|
Take a look at the program gyro2.py in the suite of example programs that is installed with VPython. It's a visualization of a precessing nutating top using Lagrangian mechanics, with a curve drawn to show the trajectory of the tip of the axle of the top. Bruce Sherwood 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 |
|
From: Bruce S. <Bru...@nc...> - 2007-06-14 23:29:52
|
You might study the example program faces_heightfield.py that comes with VPython, as it creates a surface. The most general VPython object is "faces" which lets you display arbitrary triangles and specify lighting at vertices. This low-level object could be used to display a portion of a sphere. Or if you want to display a portion of a sphere as a grid, use the "curve" object. There exists a beta version of VPython which lets you specify that an object is transparent. See the "Recent developments" section of vpython.org. Unfortunately the Windows version has some serious bugs (see the documentation in the Recent developments section) and there is no Macintosh version. The Linux version mostly works correctly. Bruce Sherwood pri...@gm... wrote: > hi folks, > > I am new to VPython so this question may sound a little bit naive; > I've got a question concerning the problem how to visiualize a 2D-manifold in Vypthon. In this special case, the parameters are Theta and Phi to just plot a part of the surface of a sphere, where the Radius is constant. An additional feature would be that the surface is something like transparent or it also could be a spherical grid. I hope my english is not too bad, so that some of you could understand what my problem currently is. I hope I'll receive any help soon. > > Thank you very much. > > greets from germany > > -Philipp > |