You can subscribe to this list here.
2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(4) |
Jul
(1) |
Aug
|
Sep
(15) |
Oct
(32) |
Nov
(35) |
Dec
(48) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(46) |
Feb
(22) |
Mar
(65) |
Apr
(49) |
May
(22) |
Jun
(29) |
Jul
(51) |
Aug
(34) |
Sep
(32) |
Oct
(46) |
Nov
(30) |
Dec
(32) |
2002 |
Jan
(48) |
Feb
(4) |
Mar
(20) |
Apr
(28) |
May
(13) |
Jun
(34) |
Jul
(51) |
Aug
(15) |
Sep
(15) |
Oct
(35) |
Nov
(15) |
Dec
(20) |
2003 |
Jan
(31) |
Feb
(111) |
Mar
(41) |
Apr
(28) |
May
(36) |
Jun
(29) |
Jul
(27) |
Aug
(29) |
Sep
(47) |
Oct
(28) |
Nov
(7) |
Dec
(26) |
2004 |
Jan
(44) |
Feb
(9) |
Mar
(17) |
Apr
(26) |
May
(58) |
Jun
(13) |
Jul
(44) |
Aug
(64) |
Sep
(30) |
Oct
(11) |
Nov
(21) |
Dec
(28) |
2005 |
Jan
(29) |
Feb
(11) |
Mar
(11) |
Apr
(22) |
May
(85) |
Jun
(46) |
Jul
(17) |
Aug
(18) |
Sep
(14) |
Oct
(22) |
Nov
(1) |
Dec
(45) |
2006 |
Jan
(20) |
Feb
(36) |
Mar
(18) |
Apr
(24) |
May
(21) |
Jun
(48) |
Jul
(23) |
Aug
(20) |
Sep
(10) |
Oct
(41) |
Nov
(46) |
Dec
(40) |
2007 |
Jan
(40) |
Feb
(20) |
Mar
(13) |
Apr
(6) |
May
(24) |
Jun
(31) |
Jul
(30) |
Aug
(11) |
Sep
(11) |
Oct
(10) |
Nov
(56) |
Dec
(64) |
2008 |
Jan
(64) |
Feb
(22) |
Mar
(63) |
Apr
(28) |
May
(25) |
Jun
(36) |
Jul
(11) |
Aug
(9) |
Sep
(14) |
Oct
(41) |
Nov
(46) |
Dec
(130) |
2009 |
Jan
(95) |
Feb
(41) |
Mar
(24) |
Apr
(35) |
May
(53) |
Jun
(67) |
Jul
(48) |
Aug
(48) |
Sep
(86) |
Oct
(75) |
Nov
(64) |
Dec
(52) |
2010 |
Jan
(57) |
Feb
(31) |
Mar
(28) |
Apr
(40) |
May
(25) |
Jun
(42) |
Jul
(79) |
Aug
(31) |
Sep
(49) |
Oct
(66) |
Nov
(38) |
Dec
(25) |
2011 |
Jan
(29) |
Feb
(18) |
Mar
(44) |
Apr
(6) |
May
(28) |
Jun
(31) |
Jul
(36) |
Aug
(24) |
Sep
(30) |
Oct
(23) |
Nov
(21) |
Dec
(27) |
2012 |
Jan
(14) |
Feb
(11) |
Mar
(2) |
Apr
(48) |
May
(7) |
Jun
(32) |
Jul
(22) |
Aug
(25) |
Sep
(31) |
Oct
(32) |
Nov
(21) |
Dec
(17) |
2013 |
Jan
(44) |
Feb
(27) |
Mar
(3) |
Apr
(1) |
May
|
Jun
|
Jul
(3) |
Aug
(4) |
Sep
(1) |
Oct
(7) |
Nov
(5) |
Dec
(5) |
2014 |
Jan
|
Feb
|
Mar
|
Apr
(3) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(3) |
Dec
(2) |
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2017 |
Jan
(7) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2019 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Bruce S. <Bru...@nc...> - 2008-03-30 15:20:15
|
This is a limitation of gtk1 on which Visual 3 was based, so Visual 3 on Mac and Linux places windows in random positions. Visual 4 is based on gtk2 which permits specifying window position. Bruce Sherwood Joe Heafner wrote: > VPython installed via latest Fink under OS X 10.5.2. I can't get scene.x > and scene.y to work; they're ignored. Can anyone confirm whether this is > a bug? > > Joe |
From: Bruce S. <Bru...@nc...> - 2008-03-30 15:18:50
|
It's nothing more than the fact that floating-point numbers can be represented only approximately in a computer. A simple example from ordinary pencil-and-paper calculations is that 1/3 + 1/3 + 1/3 = 1, but 0.33+0.33+0.33 = .99. If you want arange to produce 0, "1/3", "2/3", but not "1", you should write something like arange(0.0, 1.0-.1, 1.0/3.0). More generally, if you want to go from xi to xf in floating-point increments dx, and not include xf, write arange(xi, xf-0.5*dx, dx). Another solution is something like this, using integers: while n in range(ni, nf, dn): x = scale*n # where scale is a floating-point scale factor .... Bruce Sherwood Frédéric Mantegazza wrote: > On dimanche 30 mars 2008, Joe Heafner wrote: > >> Okay this is driving me crazy. Typing arange(0.1,0.4,0.1) should give >> [0.1, 0.2, 0.3] but instead it gives [0.1, 0.2, 0.3, 0.4]. Typing >> arange(0.1,0.5, 0.1) should give [0.1, 0.2, 0.3, 0.4] and it indeed >> does. Another example that doesn't give the "correct" result is >> arange(0.2,0.8,0.2), which gives [ 0.2, 0.4, 0.6, 0.8]. Is this a bug in >> the arange() code? I've tinkered with this for two days and there seems >> to be no way to predict when arange() will behave as documented. I have >> my students working on a small assignment that uses arange() and I don't >> want this to affect their work. Is there some detail I'm overlooking? > > arange([start,] stop[, step,], dtype=None) > > For integer arguments, just like range() except it returns an array > whose type can be specified by the keyword argument dtype. If dtype > is not specified, the type of the result is deduced from the type of > the arguments. > > For floating point arguments, the length of the result is ceil((stop - > start)/step). This rule may result in the last element of the result > being greater than stop. > > I'm afraid you will have to check the result, and correct it. But I agree, > this is a strange behaviour! > |
From: Frédéric M. <fre...@gb...> - 2008-03-30 13:55:27
|
On dimanche 30 mars 2008, Joe Heafner wrote: > Okay this is driving me crazy. Typing arange(0.1,0.4,0.1) should give > [0.1, 0.2, 0.3] but instead it gives [0.1, 0.2, 0.3, 0.4]. Typing > arange(0.1,0.5, 0.1) should give [0.1, 0.2, 0.3, 0.4] and it indeed > does. Another example that doesn't give the "correct" result is > arange(0.2,0.8,0.2), which gives [ 0.2, 0.4, 0.6, 0.8]. Is this a bug in > the arange() code? I've tinkered with this for two days and there seems > to be no way to predict when arange() will behave as documented. I have > my students working on a small assignment that uses arange() and I don't > want this to affect their work. Is there some detail I'm overlooking? arange([start,] stop[, step,], dtype=None) For integer arguments, just like range() except it returns an array whose type can be specified by the keyword argument dtype. If dtype is not specified, the type of the result is deduced from the type of the arguments. For floating point arguments, the length of the result is ceil((stop - start)/step). This rule may result in the last element of the result being greater than stop. I'm afraid you will have to check the result, and correct it. But I agree, this is a strange behaviour! -- Frédéric http://www.gbiloba.org |
From: Joe H. <hea...@gm...> - 2008-03-30 13:36:00
|
Okay this is driving me crazy. Typing arange(0.1,0.4,0.1) should give [0.1, 0.2, 0.3] but instead it gives [0.1, 0.2, 0.3, 0.4]. Typing arange(0.1,0.5, 0.1) should give [0.1, 0.2, 0.3, 0.4] and it indeed does. Another example that doesn't give the "correct" result is arange(0.2,0.8,0.2), which gives [ 0.2, 0.4, 0.6, 0.8]. Is this a bug in the arange() code? I've tinkered with this for two days and there seems to be no way to predict when arange() will behave as documented. I have my students working on a small assignment that uses arange() and I don't want this to affect their work. Is there some detail I'm overlooking? Joe |
From: Joe H. <hea...@gm...> - 2008-03-30 03:13:48
|
When I type arange(1, 3, 1) I get [1, 2] as expected. When I type arange(0.1, 0.3, 0.1) I get [0.1, 0.2] as expected. But when I type arange(0.1, 3*0.1, 0.1) I get [0.1, 0.2, 0.3], which is not what would expect. I can't find this behavior documented anywhere. What's going on? Joe |
From: Joe H. <hea...@gm...> - 2008-03-29 23:12:30
|
VPython installed via latest Fink under OS X 10.5.2. I can't get scene.x and scene.y to work; they're ignored. Can anyone confirm whether this is a bug? Joe |
From: Erik T. <mrl...@gm...> - 2008-03-29 02:25:38
|
I have been getting the same behavior on an Windows XP virtual machine (Parallels) although I haven't seen any error output mentioning Numpy. The old stable version of VPython works fine but all of the Beta versions I've tried have crashed (the oldest one I tried was Beta 14). Attached is a screenshot of the terminal error message after I tried to display a sphere() using the latest Beta #26. -Erik Thompson On Fri, Mar 28, 2008 at 4:49 PM, Bruce Sherwood <Bru...@nc...> wrote: > This behavior is not familiar to me. You don't say what platform you're > running on. It could be informative to run an example program from a > typescript/terminal, as you may get additional error messages that way. > > Bruce Sherwood > > > > Symion wrote: > > I've just installed python 2.5.2, no worries. > > I then installed Vpython 4.beta.26, no worries. > > > > >From IDLE I run stonehenge.py (standard test program). > > After a fairly long wait, the scene window pops up and vanishes and the > > program ends without a trace and puts me back into IDLE. > > > > Same problem for all vpython scripts. > > Tried running standard python programs, no worries! > > > > Switched on DEBUG. > > > > Before it dumped me back into Desktop, I saw something about Numpy? and > > a Windows Error. > > > > Can anyone help? > > > > Cheers Symion > > ------------------------------------------------------------------------- > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace > _______________________________________________ > Visualpython-users mailing list > Vis...@li... > https://lists.sourceforge.net/lists/listinfo/visualpython-users > |
From: Bruce S. <Bru...@nc...> - 2008-03-29 00:49:29
|
This behavior is not familiar to me. You don't say what platform you're running on. It could be informative to run an example program from a typescript/terminal, as you may get additional error messages that way. Bruce Sherwood Symion wrote: > I've just installed python 2.5.2, no worries. > I then installed Vpython 4.beta.26, no worries. > > >From IDLE I run stonehenge.py (standard test program). > After a fairly long wait, the scene window pops up and vanishes and the > program ends without a trace and puts me back into IDLE. > > Same problem for all vpython scripts. > Tried running standard python programs, no worries! > > Switched on DEBUG. > > Before it dumped me back into Desktop, I saw something about Numpy? and > a Windows Error. > > Can anyone help? > > Cheers Symion |
From: Symion <sy...@pr...> - 2008-03-28 10:16:50
|
I've just installed python 2.5.2, no worries. I then installed Vpython 4.beta.26, no worries. From IDLE I run stonehenge.py (standard test program). After a fairly long wait, the scene window pops up and vanishes and the program ends without a trace and puts me back into IDLE. Same problem for all vpython scripts. Tried running standard python programs, no worries! Switched on DEBUG. Before it dumped me back into Desktop, I saw something about Numpy? and a Windows Error. Can anyone help? Cheers Symion |
From: petro f. <pet...@gm...> - 2008-03-28 02:00:05
|
And please add : to stop and clean all process running if we click the close or exit button of the scene window so it could not freeze or hung. that would be nice :) thanks you. > I was thinking that it should be easier, and useful in general, > > to add commands to stop/delay/restart/refresh the rendering, > > than having to program extra logic (pre-calculation, storing > > results, analysing, etc.) for each application that needs this. > > > |
From: Bruce S. <Bru...@nc...> - 2008-03-27 19:09:45
|
Thanks. I misunderstood, not realizing that the graph case was just meant to be an example of a more general issue, one which indeed people from time to time have suggested. Bruce Sherwood Hans-Joachim Gurt wrote: > Hans-Joachim Gurt wrote: > >>>the scene is updated & resized after every calculation. >>>The effect can be seen with .. one of the example programs, .. >>>It would be nice if there were commands to stop/ >>>restart updating and forcing a refresh of the scene. >>>A similar request was on the mailinglist back in 2006-09 >>>"freezing the scene", but I found no followup to that posting. > > > Bruce Sherwood wrote: > >>If you don't want continual autoscaling of a graph, > > > That was just one easy example for cases where it is > undesirable to show intermediate results in the scene. > The posting "freezing the scene" had another example. > > > >>just specify specific limits of the x and y axes >>before starting the plotting, by specifying these limits >>in creating a gdisplay object. > > > I was thinking that it should be easier, and useful in general, > to add commands to stop/delay/restart/refresh the rendering, > than having to program extra logic (pre-calculation, storing > results, analysing, etc.) for each application that needs this. > > > By(t)e, > HaJo Gurt |
From: Hans-Joachim G. <gu...@gm...> - 2008-03-27 16:58:04
|
Hans-Joachim Gurt wrote: >> the scene is updated & resized after every calculation. >> The effect can be seen with .. one of the example programs, .. >> It would be nice if there were commands to stop/ >> restart updating and forcing a refresh of the scene. >> A similar request was on the mailinglist back in 2006-09 >> "freezing the scene", but I found no followup to that posting. Bruce Sherwood wrote: >If you don't want continual autoscaling of a graph, That was just one easy example for cases where it is undesirable to show intermediate results in the scene. The posting "freezing the scene" had another example. >just specify specific limits of the x and y axes >before starting the plotting, by specifying these limits >in creating a gdisplay object. I was thinking that it should be easier, and useful in general, to add commands to stop/delay/restart/refresh the rendering, than having to program extra logic (pre-calculation, storing results, analysing, etc.) for each application that needs this. By(t)e, HaJo Gurt -- "Use the force - change the source." --Sven Guckes |
From: Gary P. <gar...@gm...> - 2008-03-27 14:31:21
|
On Wed, Mar 26, 2008 at 9:59 AM, Joe Heafner <hea...@gm...> wrote: > I can type > > > locations = [vector(-6e-11,0,6e-11),vector(-6e-11,-6e-11,0),\ > vector(-6e-11,6e-11,0),vector(-6e-11,0,-6e-11)] > > and > > > locations.append(vector(-6e-11,0,6e-11)) > locations.append(vector(-6e-11,-6e-11,0)) > locations.append(vector(-6e-11,6e-11,0)) > locations.append(vector(-6e-11,0,-6e-11)) > > > but I get an index out of range error when I type > > > locations[0] = vector(-6e-11,0,6e-11) > locations[1] = vector(-6e-11,-6e-11,0) > locations[2] = vector(-6e-11,6e-11,0) > locations[3] = vector(-6e-11,0,-6e-11) > > Does Visual change the initial index or is something else going on? I can't reproduce that. Things work as expected for me. (WinXP, visual 3.2.10, python 2.5.1) try len(locations) what happens if you simply try to display locations[0] or locations[3], etc ? -gary > > Joe > ------------------------------------------------------------------------- > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > > http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace > _______________________________________________ > Visualpython-users mailing list > Vis...@li... > https://lists.sourceforge.net/lists/listinfo/visualpython-users > > |
From: Joe H. <hea...@gm...> - 2008-03-26 13:59:22
|
I can type locations = [vector(-6e-11,0,6e-11),vector(-6e-11,-6e-11,0),\ vector(-6e-11,6e-11,0),vector(-6e-11,0,-6e-11)] and locations.append(vector(-6e-11,0,6e-11)) locations.append(vector(-6e-11,-6e-11,0)) locations.append(vector(-6e-11,6e-11,0)) locations.append(vector(-6e-11,0,-6e-11)) but I get an index out of range error when I type locations[0] = vector(-6e-11,0,6e-11) locations[1] = vector(-6e-11,-6e-11,0) locations[2] = vector(-6e-11,6e-11,0) locations[3] = vector(-6e-11,0,-6e-11) Does Visual change the initial index or is something else going on? Joe |
From: Kadir H. <kha...@ya...> - 2008-03-26 10:42:03
|
Hi Symion, I am not an astronomer, but while playing with VPython I was trying to solve the same problem you have mentioned a few days ago: Central lighting. I tried to post an answer to your previous note with my simple solar system VPython "simulation", but due to its attachments above the size limit, it was caught-up in the moderator queue. I am posting again a simplified version of it without the textures on the planets. It is not a realistic solar system, with no scale or whatsoever, but provides a "tricky solution" to the central lighting issue. Bruce has warned me that the future VPython implementation may not be implementing a similar "spot light" system, so with that warning, may be you can use it for your wish list, to create a more realistic solar system with correct orbits and periods. I have the textured version where the Earth, the Moon and the Mars are textured with some photo images. I can send textured version to you if you like, but I understand you are using VPython V3 at the moment where you can not use texturing functions. (Actually, the code is almost there, with texture option for the spheres replaced by simple color option. You need specified texturefiles as well of course). Have fun, Kadir ----------------------------- from __future__ import division from visual import * from PIL import Image # from the Python Imaging Library (PIL); www.pythonware.com/products/pil from random import random from random import uniform scene.autoscale = 0 im = Image.open("earth3.jpg") # read a jpeg file named earth3.jpg im = im.resize((256,256)) # resize so that length and width are powers of 2 data = array(list(im.getdata()),ubyte) # read pixel data into flat Numeric array data = reshape(data, (256,256,3)) # reshape for rgb texture im = data[::-1].copy() # copy() is necessary to make array contiguous in memory im2 = Image.open("Mars400.jpg") # read a jpeg file named Mars400.jpg im2 = im2.resize((256,256)) # resize so that length and width are powers of 2 data2 = array(list(im2.getdata()),ubyte) # read pixel data into flat Numeric array data2 = reshape(data2, (256,256,3)) # reshape for rgb texture im2 = data2[::-1].copy() # copy() is necessary to make array contiguous in memory im3 = Image.open("Luna400.jpg") # read a jpeg file named Luna400.jpg im3 = im3.resize((256,256)) # resize so that length and width are powers of 2 data3 = array(list(im3.getdata()),ubyte) # read pixel data into flat Numeric array data3 = reshape(data3, (256,256,3)) # reshape for rgb texture im3 = data3[::-1].copy() # copy() is necessary to make array contiguous in memory photo = texture(data=im, type="rgb") photo2 = texture(data=im2, type="rgb") photo3 = texture(data=im3, type="rgb") scene.width = 1024 scene.title = "Solar System" scene.height = 800 scene.range = (12,12,12) scene.forward = (-0.2,-0.2,-1) earth = frame(pos=(-10,0,+10)) pib8 = pi/8 k1 = sphere(frame=earth, pos=(-3,0,-3), radius=1, color=(0.6,0.6,0.6), shininess=0) k2 = sphere(frame=earth, pos=(0,0,0), radius=2, color=color.blue, axis=(0,0.4244,1), shininess=0) eaxis = box(frame=earth, pos=k2.pos, size=(0.1,k2.radius*2.4,0.1), axis=k2.axis) k3 = sphere(pos=(+15,0,+15), radius=1, color=color.green, shininess=0) k4 = sphere(pos=(+5,0,-5), radius=1, color=color.red, shininess=0) scene.lights = [] scene.ambient = 0.2 light(pos=(0, 0, 0), local=True, color=0.2) sun = sphere(pos=(0,0,0), radius=1, color=(0.99,0.99,0.50), opacity=0.90) spot7 = light(pos=(-4,-4,0), local=True, color=0.8, spot_direction=(1,1,0), spot_cutoff=10) spot8 = light(pos=(+4,+4,0), local=True, color=0.8, spot_direction=(-1,-1,0), spot_cutoff=10) spot9 = light(pos=(-4,0,-4), local=True, color=0.8, spot_direction=(1,0,1), spot_cutoff=10) spot10 = light(pos=(+4,0,+4), local=True, color=0.8, spot_direction=(-1,0,-1), spot_cutoff=10) spot11 = light(pos=(0,-4,-4), local=True, color=0.8, spot_direction=(0,1,1), spot_cutoff=10) spot12 = light(pos=(0,+4,+4), local=True, color=0.8, spot_direction=(0,-1,-1), spot_cutoff=10) ring1 = ring(pos=sun.pos, axis=(0,1,0), radius=sun.radius*1.2, thickness=sun.radius*0.01, color=color.yellow) ring2 = ring(pos=sun.pos, axis=(1,0,0), radius=sun.radius*1.2, thickness=sun.radius*0.01, color=color.red) ring3 = ring(pos=sun.pos, axis=(0,0,1), radius=sun.radius*1.2, thickness=sun.radius*0.01, color=color.blue) for i in(range(1,200)): x = uniform(-50,50) y = uniform(-50,50) sphere(pos=(x,y), radius=0.05, color=color.white, shininess=1) pi4 = pi/512 pi2 = pi4*2 pie = pi4*4 pi8 = pie*2 while True: k2.rotate(angle=pie, axis=(0,1,-0.4244)) earth.rotate(angle=pi4,axis=(0,1,0), origin=(0,0,0)) k1.rotate(angle=pi2, axis=(0,1,0), origin=(0,0,0)) k3.rotate(angle=pi4, axis=(0,1,0), origin=(0,0,0)) k4.rotate(angle=pi8, axis=(0,1,0), origin=(0,0,0)) rate(32) ____________________________________________________________________________________ Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs |
From: Bruce S. <Bru...@nc...> - 2008-03-26 03:15:37
|
I'm not sure I understand the question. If you don't want continual autoscaling of a graph, just specify specific limits of the x and y axes before starting the plotting, by specifying these limits in creating a gdisplay object. As to the autoscaling done in the graph machinery, rescaling isn't done for every plot. Rather, if the new values require rescaling, the rescaling is done about 1% larger than needed, so that there is a good chance that another rescale won't be required for a while. Bruce Sherwood Hans-Joachim Gurt wrote: > Hi, > > I noticed that the scene is updated & resized after every calculation. > > The effect can be seen with just a small change (added print-statement) > to one of the example programs, e.g.: > > > from visual.graph import * > > funct1 = gdots(color=color.red) > funct2 = gvbars(delta=0.05, color=color.blue) > > for x in arange(0.0, 10.10, 0.1): > y1 = 5.0 * cos(2.0*x) * exp(-0.2*x) > y2 = 4.0 * cos(0.5*x) * exp(-0.1*x) > print x, y1, y2 # causes short delay > funct1.plot(pos=( x,y1 )) > funct2.plot(pos=( x,y2 )) > > > The scene is 'blown up' as new values are added. > > It would be nice if there were commands to stop/restart updating > and forcing a refresh of the scene. > > A similar request was on the mailinglist back in 2006-09 > "freezing the scene", but I found no followup to that posting. > > > By(t)e, > HaJo Gurt |
From: Bruce S. <Bru...@nc...> - 2008-03-26 03:01:32
|
1) I don't see how to put VPython inside something else. 2) See the example program stonehenge.py. Bruce Sherwood Astan Chee wrote: > Hi, > Sorry, my mistake. It does work properly. The z-position of the camera > doesnt change and the camera strafes to the left or right properly, but > it does this disregarding where the camera is facing. Also, I have > several other questions about VPython: > 1. Is it possible to put the VPython frame in a wxFrame from wxPython? > 2. Has anyone tried to place a camera or affix in on a moving object, so > that the camera moves according to the object it is placed on? > Thanks again for the help. > Cheers > Astan > > Astan Chee wrote: >> Hi, >> Sorry, I turned off scene.userspin and what I mean about the problem is >> that if I move the camera to the right abit, turn it to 20 degrees to >> the left and then move it to the right abit more, the second time it >> moves to the right, it seems to also move further away from the sphere. >> Why does this happen? >> Thanks again for your help. >> Cheers >> Astan >> >> Bruce Sherwood wrote: >> >>> I don't understand your question. All of the keys seem to do what you >>> say they should do. There's no way to rotate the camera (at least in >>> the usual VPython sense) because you've set scene.userspin = 0. >>> >>> As for scene.forward, it is a vector pointing from the camera position >>> toward scene.center. The magnitude of the vector scene.forward is >>> irrelevant; it's just a direction. >>> >>> Bruce Sherwood >>> >>> Astan Chee wrote: >>> >>>> Hi, >>>> So now I've had abit of success. I can move the camera around using >>>> keyboard shortcuts but whenever the camera is rotated, the move >>>> up/down and strafe left/right becomes inconsistent. How do I update >>>> these? Im thinking I have to change the scene.forward somewhere, but >>>> to what value? >>>> Thanks again for any advice. >>>> Astan >>>> Below is my code >>>> >>>> from __future__ import division >>>> from visual import * >>>> import random >>>> >>>> if __name__ == '__main__': >>>> >>>> # Set up window and sceen. >>>> scene = display() >>>> scene.fullscreen = 0 >>>> scene.autocenter = 0 >>>> scene.autoscale = 0 >>>> scene.userzoom = 0 >>>> scene.userspin = 0 >>>> scene.ambient = 0 >>>> outer = 10 >>>> outer*= 2 >>>> scene.range = (outer,outer,outer) >>>> >>>> rate(50) >>>> >>>> sunpos = [0,0,0] >>>> color = [ 3, 1.5, .75] >>>> sunradius = 2 >>>> sun = sphere( pos=sunpos, radius=sunradius, color=color) >>>> >>>> while True: if scene.kb.keys: >>>> s = scene.kb.getkey() >>>> angle = 0 >>>> #move in / out >>>> if s == 'w' or s == 's': >>>> ray = 1 >>>> if s == 's': >>>> ray = -1 >>>> scene.center = scene.center+scene.forward*ray/2. >>>> #strafe left / right >>>> if s == 'a' or s == 'd': >>>> move = vector(-0.5,0,0) >>>> if s == 'd': >>>> move = vector(0.5,0,0) >>>> scene.center = scene.center+move >>>> #look left / right >>>> if s == 'left' or s == 'right': >>>> ray = 0 >>>> angle = 0.6 >>>> if s == 'right': >>>> angle = -0.6 >>>> newforward = rotate(scene.forward, axis=scene.up, >>>> angle=angle/10.) >>>> scene.center = >>>> scene.mouse.camera+newforward*mag(scene.center-scene.mouse.camera) >>>> scene.forward = newforward >>>> scene.center = scene.center+scene.forward*ray/2. >>>> #move up / down >>>> if s == 'f' or s == 'v': >>>> move = vector(0,-0.5,0) >>>> if s == 'v': >>>> move = vector(0,0.5,0) >>>> scene.center = scene.center+move >>>> >>>> >>>> >>> >> >> > > -- > "Formulations of number theory: Complete, Consistent, Non-trivial. Choose two." > > > <http://www.animallogic.com> > > Please think of the environment before printing this email. > > This email and any attachments may be confidential and/or privileged. If > you are not the intended recipient of this email, you must not disclose > or use the information > contained in it. Please notify the sender immediately and delete this > document if you have received it in error. We do not guarantee this > email is error or virus free. > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace > > > ------------------------------------------------------------------------ > > _______________________________________________ > Visualpython-users mailing list > Vis...@li... > https://lists.sourceforge.net/lists/listinfo/visualpython-users |
From: Symion <sy...@pr...> - 2008-03-26 01:39:23
|
Hi there, Reading through the messages from the mailing list, I've noticed that a number of people are using Vpython for astronomical simulations. Here is another program that puts most of the necessary data into a single list so as to produce a scaled representation of The Solar System. It includes all planets and most of the major moons. These are lined up so that easy comparisons can be made between each object. All data has been researched from online sources (JPL, NASA, The Wiki), so hopefully everything is correct. The original reason for writing this program came from a conversation I had with someone who refused to accept Solar Energy as a viable solution to our energy needs. It really annoyed me that he seemed unable to comprehend just how big the Sun really is! So lets hope this program doesn't fall over and may be useful to those fellow astronomy buffs. Controls are simply point and click. Cheers from __future__ import division from visual import * from random import * '''Welcome to The Solar System - (c) 2008 Symion''' class Solar: '''Compare Astronomical Objects''' def __init__(self, o=(0,0,0), r=1.0, c=(1,1,1)): self.orbit=o self.radius=r self.color=c sphere(pos=o,radius=r,color=c) ## data contains name,radius coefficient ,orbital coefficient,mass coefficient,color Data=[['Sol',1.09088e+002,0.00000e+000,3.33166e+005,(3.0,3.0,0.0)], ['Mercury',3.82985e-001,3.87099e-001,5.52764e-002,(0.5,0.5,0.5)], ['Venus',9.49929e-001,7.23262e-001,8.15745e-001,(0.9,0.4,0.5)], ['Earth',1.00000e+000,1.00000e+000,1.00000e+000,(0.2,0.2,1.0)], ['Luna',2.72799e-001,1.00000e+000,1.67219e-002,(0.4,0.4,0.4)], ['Mars',5.33276e-001,1.52366e+000,1.07538e-001,(1.0,0.2,0.0)], ['Jupiter',1.12215e+001,5.20274e+000,3.18258e+002,(0.4,0.3,0.1)], ['Io',2.85826e-001,5.20274e+000,1.49615e-002,(0.5,0.3,0.0)], ['Europa',2.45644e-001,5.20274e+000,8.04020e-003,(0.6,0.6,0.9)], ['Ganymede',4.13436e-001,5.20274e+000,2.48074e-002,(0.6,0.6,0.5)], ['Callisto',3.77178e-001,5.20274e+000,1.80067e-002,(0.7,0.7,0.9)], ['Saturn',9.45982e+000,9.55481e+000,9.51424e+001,(0.8,0.6,0.1)], ['Titan',4.04175e-001,9.55481e+000,2.26131e-002,(0.6,0.5,0.9)], ['Rhea',1.19918e-001,9.55481e+000,3.86935e-004,(0.5,0.6,0.7)], ['Uranus',4.01185e+000,1.91911e+001,1.45394e+001,(0.2,0.2,0.7)], ['Titania',1.23842e-001,1.91911e+001,5.91290e-004,(0.6,0.6,0.9)], ['Oberon',1.19447e-001,1.91911e+001,5.04355e-004,(0.5,0.6,0.7)], ['Neptune',3.88730e+000,3.01090e+001,1.70854e+001,(0.1,0.4,0.8)], ['Triton',2.12369e-001,3.01090e+001,3.60134e-003,(0.2,0.5,0.8)], ['Pluto',1.80505e-001,3.95289e+001,2.12730e-003,(0.6,0.6,0.9)], ['Charon',9.51185e-002,3.95289e+001,3.18258e-004,(0.4,0.4,0.4)]] ''' ['Ring',1.38487e+001,9.55481e+000,9.66332e-001,(0.5,0.6,0.7)], ['Asteroids',8.63915e+005,0.00000e+000,1.24288e+000,(0.2,0.2,0.2)]] ''' ## Define Constants G=6.6732e-11 AU=1.496e+011 ER=6.371e+06 EM=5.970e+024 ## Setup the Graphic Window scene.visible=0 scene.x=100 scene.y=100 x=scene.x+scene.width y=scene.y scene.title='Compare The Sun with The Planets - (c) 2008 Symion' scene.background=(0.0,0.05,0.15) scene.lights=[vector(-3,0,0)] scene.ambient=.5 ## Start with The Sun ## Pre calculate Radii & Distance radii=[Data[0][1]*ER] distance=[vector(0,0,0)] loc=distance[0]+vector(radii[0],0,0) for v in Data[1:]: radii.append(v[1]*ER) loc=loc+vector(radii[-1],0,0) distance.append(loc) loc=loc+vector(radii[-1],0,0) ## Do the Deed sol=Solar(o=distance[0],r=radii[0],c=Data[0][4]) mercury=Solar(o=distance[1],r=radii[1],c=Data[1][4]) venus=Solar(o=distance[2],r=radii[2],c=Data[2][4]) earth=Solar(o=distance[3],r=radii[3],c=Data[3][4]) luna=Solar(o=distance[4],r=radii[4],c=Data[4][4]) mars=Solar(o=distance[5],r=radii[5],c=Data[5][4]) jupiter=Solar(o=distance[6],r=radii[6],c=Data[6][4]) io=Solar(o=distance[7],r=radii[7],c=Data[7][4]) europa=Solar(o=distance[8],r=radii[8],c=Data[8][4]) ganymede=Solar(o=distance[9],r=radii[9],c=Data[9][4]) callisto=Solar(o=distance[10],r=radii[10],c=Data[10][4]) saturn=Solar(o=distance[11],r=radii[11],c=Data[11][4]) titan=Solar(o=distance[12],r=radii[12],c=Data[12][4]) rhea=Solar(o=distance[13],r=radii[13],c=Data[13][4]) uranus=Solar(o=distance[14],r=radii[14],c=Data[14][4]) titania=Solar(o=distance[15],r=radii[15],c=Data[15][4]) oberon=Solar(o=distance[16],r=radii[16],c=Data[16][4]) neptune=Solar(o=distance[17],r=radii[17],c=Data[17][4]) triton=Solar(o=distance[18],r=radii[18],c=Data[18][4]) pluto=Solar(o=distance[19],r=radii[19],c=Data[19][4]) charon=Solar(o=distance[20],r=radii[20],c=Data[20][4]) scene.visible=1 scene.autoscale=0 ## Define other Window work=display(title='Information Window', width=300, height=250, center=(0,0,0), background=(0.5,0.5,0.5)) ## Choose the index for the initial Object of Focus n=0 work.userzoom=0 work.userspin=0 work.x=x work.y=y ## Fancy border curve(pos=[(-1,-1),(-1,1),(1,1),(1,-1),(-1,-1)],color=(0,0,0)) curve(pos=[(-1.1,-1.1),(-1.1,1.1),(1.1,1.1),(1.1,-1.1),(-1.1,-1.1)],color=(1,1,1)) cube=box(pos=((-1,-1,0)),width=0.1,height=0.1,length=0.1,color=(1,0,0)) work.forward=vector(0,0,-1) ## Initialize Data Window s=Data[n][0]+'\nOrbit %0.3e m\nRadius %0.3e m\nMass %0.3e kg\ng %0.5f m/s/s\nEscape V %0.4f km/s' %(Data[n][2]*AU,radii[n],Data[n][3]*EM,(G*Data[n][3]*EM)/(radii[n]**2),sqrt((2*G*Data[n][3]*EM)/(radii[n]))/1000.0) label(pos=(0,-0.4), opacity=1, font='Courier', height=9, color=(1,1,1), box=1, text=s) work.autoscale=0 ## User Input: Choose an Object count=0.0 while 1: rate(50) cube.rotate(angle=radians(5),axis=(sin(count),.5,.5)) if scene.mouse.events>0: m=scene.mouse.getevent() if m.release: if m.pick: o=m.pick scene.center=o.pos n=o.display.objects.index(o) if n>-1 and n<len(Data): work.objects[-1].visible=0 s=Data[n][0]+'\nOrbit %0.3e m\nRadius %0.3e m\nMass %0.3e kg\ng %0.5f m/s/s\nEscape V %0.4f km/s' %(Data[n][2]*AU,radii[n],Data[n][3]*EM,(G*Data[n][3]*EM)/(radii[n]**2),sqrt((2*G*Data[n][3]*EM)/(radii[n]))/1000.0) label(pos=(0,-0.4), opacity=1, font='Courier', height=9, color=(1,1,1), box=1, text=s) else: pass else: p=scene.mouse.pos scene.center=p else: pass elif work.mouse.events>0: m=work.mouse.getevent() if m.release: if m.pick: count+=.1 cube.color=(abs(sin(count)),abs(cos(count)),abs(sinh(count))) else: pass else: pass else: pass |
From: Astan C. <st...@al...> - 2008-03-26 00:37:55
|
Hi, Sorry, my mistake. It does work properly. The z-position of the camera doesnt change and the camera strafes to the left or right properly, but it does this disregarding where the camera is facing. Also, I have several other questions about VPython: 1. Is it possible to put the VPython frame in a wxFrame from wxPython? 2. Has anyone tried to place a camera or affix in on a moving object, so that the camera moves according to the object it is placed on? Thanks again for the help. Cheers Astan Astan Chee wrote: > Hi, > Sorry, I turned off scene.userspin and what I mean about the problem is > that if I move the camera to the right abit, turn it to 20 degrees to > the left and then move it to the right abit more, the second time it > moves to the right, it seems to also move further away from the sphere. > Why does this happen? > Thanks again for your help. > Cheers > Astan > > Bruce Sherwood wrote: > >> I don't understand your question. All of the keys seem to do what you >> say they should do. There's no way to rotate the camera (at least in >> the usual VPython sense) because you've set scene.userspin = 0. >> >> As for scene.forward, it is a vector pointing from the camera position >> toward scene.center. The magnitude of the vector scene.forward is >> irrelevant; it's just a direction. >> >> Bruce Sherwood >> >> Astan Chee wrote: >> >>> Hi, >>> So now I've had abit of success. I can move the camera around using >>> keyboard shortcuts but whenever the camera is rotated, the move >>> up/down and strafe left/right becomes inconsistent. How do I update >>> these? Im thinking I have to change the scene.forward somewhere, but >>> to what value? >>> Thanks again for any advice. >>> Astan >>> Below is my code >>> >>> from __future__ import division >>> from visual import * >>> import random >>> >>> if __name__ == '__main__': >>> >>> # Set up window and sceen. >>> scene = display() >>> scene.fullscreen = 0 >>> scene.autocenter = 0 >>> scene.autoscale = 0 >>> scene.userzoom = 0 >>> scene.userspin = 0 >>> scene.ambient = 0 >>> outer = 10 >>> outer*= 2 >>> scene.range = (outer,outer,outer) >>> >>> rate(50) >>> >>> sunpos = [0,0,0] >>> color = [ 3, 1.5, .75] >>> sunradius = 2 >>> sun = sphere( pos=sunpos, radius=sunradius, color=color) >>> >>> while True: if scene.kb.keys: >>> s = scene.kb.getkey() >>> angle = 0 >>> #move in / out >>> if s == 'w' or s == 's': >>> ray = 1 >>> if s == 's': >>> ray = -1 >>> scene.center = scene.center+scene.forward*ray/2. >>> #strafe left / right >>> if s == 'a' or s == 'd': >>> move = vector(-0.5,0,0) >>> if s == 'd': >>> move = vector(0.5,0,0) >>> scene.center = scene.center+move >>> #look left / right >>> if s == 'left' or s == 'right': >>> ray = 0 >>> angle = 0.6 >>> if s == 'right': >>> angle = -0.6 >>> newforward = rotate(scene.forward, axis=scene.up, >>> angle=angle/10.) >>> scene.center = >>> scene.mouse.camera+newforward*mag(scene.center-scene.mouse.camera) >>> scene.forward = newforward >>> scene.center = scene.center+scene.forward*ray/2. >>> #move up / down >>> if s == 'f' or s == 'v': >>> move = vector(0,-0.5,0) >>> if s == 'v': >>> move = vector(0,0.5,0) >>> scene.center = scene.center+move >>> >>> >>> >> > > -- "Formulations of number theory: Complete, Consistent, Non-trivial. Choose two." Animal Logic http://www.animallogic.com Please think of the environment before printing this email. This email and any attachments may be confidential and/or privileged. If you are not the intended recipient of this email, you must not disclose or use the information contained in it. Please notify the sender immediately and delete this document if you have received it in error. We do not guarantee this email is error or virus free. |
From: Astan C. <st...@al...> - 2008-03-25 23:32:55
|
Hi, Sorry, I turned off scene.userspin and what I mean about the problem is that if I move the camera to the right abit, turn it to 20 degrees to the left and then move it to the right abit more, the second time it moves to the right, it seems to also move further away from the sphere. Why does this happen? Thanks again for your help. Cheers Astan Bruce Sherwood wrote: > I don't understand your question. All of the keys seem to do what you > say they should do. There's no way to rotate the camera (at least in > the usual VPython sense) because you've set scene.userspin = 0. > > As for scene.forward, it is a vector pointing from the camera position > toward scene.center. The magnitude of the vector scene.forward is > irrelevant; it's just a direction. > > Bruce Sherwood > > Astan Chee wrote: >> Hi, >> So now I've had abit of success. I can move the camera around using >> keyboard shortcuts but whenever the camera is rotated, the move >> up/down and strafe left/right becomes inconsistent. How do I update >> these? Im thinking I have to change the scene.forward somewhere, but >> to what value? >> Thanks again for any advice. >> Astan >> Below is my code >> >> from __future__ import division >> from visual import * >> import random >> >> if __name__ == '__main__': >> >> # Set up window and sceen. >> scene = display() >> scene.fullscreen = 0 >> scene.autocenter = 0 >> scene.autoscale = 0 >> scene.userzoom = 0 >> scene.userspin = 0 >> scene.ambient = 0 >> outer = 10 >> outer*= 2 >> scene.range = (outer,outer,outer) >> >> rate(50) >> >> sunpos = [0,0,0] >> color = [ 3, 1.5, .75] >> sunradius = 2 >> sun = sphere( pos=sunpos, radius=sunradius, color=color) >> >> while True: if scene.kb.keys: >> s = scene.kb.getkey() >> angle = 0 >> #move in / out >> if s == 'w' or s == 's': >> ray = 1 >> if s == 's': >> ray = -1 >> scene.center = scene.center+scene.forward*ray/2. >> #strafe left / right >> if s == 'a' or s == 'd': >> move = vector(-0.5,0,0) >> if s == 'd': >> move = vector(0.5,0,0) >> scene.center = scene.center+move >> #look left / right >> if s == 'left' or s == 'right': >> ray = 0 >> angle = 0.6 >> if s == 'right': >> angle = -0.6 >> newforward = rotate(scene.forward, axis=scene.up, >> angle=angle/10.) >> scene.center = >> scene.mouse.camera+newforward*mag(scene.center-scene.mouse.camera) >> scene.forward = newforward >> scene.center = scene.center+scene.forward*ray/2. >> #move up / down >> if s == 'f' or s == 'v': >> move = vector(0,-0.5,0) >> if s == 'v': >> move = vector(0,0.5,0) >> scene.center = scene.center+move >> >> > > -- "Formulations of number theory: Complete, Consistent, Non-trivial. Choose two." Animal Logic http://www.animallogic.com Please think of the environment before printing this email. This email and any attachments may be confidential and/or privileged. If you are not the intended recipient of this email, you must not disclose or use the information contained in it. Please notify the sender immediately and delete this document if you have received it in error. We do not guarantee this email is error or virus free. |
From: Joel K. <jj...@ya...> - 2008-03-25 20:04:42
|
Tom Bortels is right: Phun has a lot more power than Crayon Physics does. Precisely for this reason, I think Phun presents an even stronger case for trying out the 2D ==> 3D adaptation I was thinking of in connecting Crayon Physics with VPython. Converting that "liquify" function in Phun to a 3D VPython equivalent could be a particularly interesting challenge for high school & college level programming students; my guess is that there would not be one single "best" way to do it, but rather many possible approaches that would be worth looking at. . . . Joel ____________________________________________________________________________________ Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ |
From: Hans-Joachim G. <gu...@gm...> - 2008-03-25 15:39:17
|
Hi, I noticed that the scene is updated & resized after every calculation. The effect can be seen with just a small change (added print-statement) to one of the example programs, e.g.: from visual.graph import * funct1 = gdots(color=color.red) funct2 = gvbars(delta=0.05, color=color.blue) for x in arange(0.0, 10.10, 0.1): y1 = 5.0 * cos(2.0*x) * exp(-0.2*x) y2 = 4.0 * cos(0.5*x) * exp(-0.1*x) print x, y1, y2 # causes short delay funct1.plot(pos=( x,y1 )) funct2.plot(pos=( x,y2 )) The scene is 'blown up' as new values are added. It would be nice if there were commands to stop/restart updating and forcing a refresh of the scene. A similar request was on the mailinglist back in 2006-09 "freezing the scene", but I found no followup to that posting. By(t)e, HaJo Gurt -- Confidence is the feeling you have before you understand the situation. |
From: Bruce S. <Bru...@nc...> - 2008-03-25 15:06:23
|
Naming issues: A window containing VPython graphics is a VPython "display" object. By default, when you create a sphere or other displayable object VPython creates a display object named "scene". In documentation you'll find names like "sceneb" or "scene2" as examples of displays other than the default one. from visual import * box() # by default, a display named "scene" is created, with a box scene2 = display() sphere() # this sphere will appear in a second display named "scene2" It is the case that if you have display.exit = False, closing that display doesn't terminate the program. I guess you could watch for that display or its contents no longer existing as a signal to stop the program. Bruce Sherwood petro finder wrote: > Hi Bruce, > Now I can dispose my scene ..very happy :D > I dont read carefully the visual help ( on visual help write as sceneb > ...not scene , actually it's same ...) > > but when I clicked close is oke to close the scene but the program is > getting hang > there are code of animation.. > while 1: > rate(100) > for self.wave in self.waves: > ..bla..bla.. > it's came from visual example - wave.py > I think when I close the scene window, it was not clear all the process > that running within scene. > Question ..I should fixed the code ? or there are method of scene to > clear all process? > > Thank you very much. > > > > > > 2008/3/25, Bruce Sherwood <Bru...@nc... > <mailto:Bru...@nc...>>: > > I'm not quite sure what it is you want to do, and I don't recognize your > references to "WINDOW_ON_CLOSE" and "WINDOW_ON_EXIT", but here are two > relevant points: > > 1) As stated in the Visual help, setting scene2.exit = False means that > clicking the close box on the display named "scene2" closes that display > but doesn't halt the program and doesn't close other displays. > > 2) You can dispose of a display "scene2" by saying scene2.visible = > False, > > Bruce Sherwood > > |
From: Bruce S. <Bru...@nc...> - 2008-03-25 15:00:31
|
I don't understand your question. All of the keys seem to do what you say they should do. There's no way to rotate the camera (at least in the usual VPython sense) because you've set scene.userspin = 0. As for scene.forward, it is a vector pointing from the camera position toward scene.center. The magnitude of the vector scene.forward is irrelevant; it's just a direction. Bruce Sherwood Astan Chee wrote: > Hi, > So now I've had abit of success. I can move the camera around using > keyboard shortcuts but whenever the camera is rotated, the move up/down > and strafe left/right becomes inconsistent. How do I update these? Im > thinking I have to change the scene.forward somewhere, but to what value? > Thanks again for any advice. > Astan > Below is my code > > from __future__ import division > from visual import * > import random > > if __name__ == '__main__': > > # Set up window and sceen. > scene = display() > scene.fullscreen = 0 > scene.autocenter = 0 > scene.autoscale = 0 > scene.userzoom = 0 > scene.userspin = 0 > scene.ambient = 0 > outer = 10 > outer*= 2 > scene.range = (outer,outer,outer) > > rate(50) > > sunpos = [0,0,0] > color = [ 3, 1.5, .75] > sunradius = 2 > sun = sphere( pos=sunpos, radius=sunradius, color=color) > > while True: > if scene.kb.keys: > s = scene.kb.getkey() > angle = 0 > #move in / out > if s == 'w' or s == 's': > ray = 1 > if s == 's': > ray = -1 > scene.center = scene.center+scene.forward*ray/2. > #strafe left / right > if s == 'a' or s == 'd': > move = vector(-0.5,0,0) > if s == 'd': > move = vector(0.5,0,0) > scene.center = scene.center+move > #look left / right > if s == 'left' or s == 'right': > ray = 0 > angle = 0.6 > if s == 'right': > angle = -0.6 > newforward = rotate(scene.forward, axis=scene.up, > angle=angle/10.) > scene.center = > scene.mouse.camera+newforward*mag(scene.center-scene.mouse.camera) > scene.forward = newforward > scene.center = scene.center+scene.forward*ray/2. > #move up / down > if s == 'f' or s == 'v': > move = vector(0,-0.5,0) > if s == 'v': > move = vector(0,0.5,0) > scene.center = scene.center+move > > > > > |
From: Astan C. <st...@al...> - 2008-03-25 07:12:11
|
Hi, So now I've had abit of success. I can move the camera around using keyboard shortcuts but whenever the camera is rotated, the move up/down and strafe left/right becomes inconsistent. How do I update these? Im thinking I have to change the scene.forward somewhere, but to what value? Thanks again for any advice. Astan Below is my code from __future__ import division from visual import * import random if __name__ == '__main__': # Set up window and sceen. scene = display() scene.fullscreen = 0 scene.autocenter = 0 scene.autoscale = 0 scene.userzoom = 0 scene.userspin = 0 scene.ambient = 0 outer = 10 outer*= 2 scene.range = (outer,outer,outer) rate(50) sunpos = [0,0,0] color = [ 3, 1.5, .75] sunradius = 2 sun = sphere( pos=sunpos, radius=sunradius, color=color) while True: if scene.kb.keys: s = scene.kb.getkey() angle = 0 #move in / out if s == 'w' or s == 's': ray = 1 if s == 's': ray = -1 scene.center = scene.center+scene.forward*ray/2. #strafe left / right if s == 'a' or s == 'd': move = vector(-0.5,0,0) if s == 'd': move = vector(0.5,0,0) scene.center = scene.center+move #look left / right if s == 'left' or s == 'right': ray = 0 angle = 0.6 if s == 'right': angle = -0.6 newforward = rotate(scene.forward, axis=scene.up, angle=angle/10.) scene.center = scene.mouse.camera+newforward*mag(scene.center-scene.mouse.camera) scene.forward = newforward scene.center = scene.center+scene.forward*ray/2. #move up / down if s == 'f' or s == 'v': move = vector(0,-0.5,0) if s == 'v': move = vector(0,0.5,0) scene.center = scene.center+move -- "Formulations of number theory: Complete, Consistent, Non-trivial. Choose two." Animal Logic http://www.animallogic.com Please think of the environment before printing this email. This email and any attachments may be confidential and/or privileged. If you are not the intended recipient of this email, you must not disclose or use the information contained in it. Please notify the sender immediately and delete this document if you have received it in error. We do not guarantee this email is error or virus free. |