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: Gary S. <st...@nm...> - 2002-06-21 20:49:55
|
> These two numbers can be entirely different. Your program measures the > second, which is also what rate() controls. There is no way to change > the rendering frame rate in VPython (except to buy a faster computer :), Question: if you've re-computed a (or requested a new) frame before the previous one was done rendering, does the rendering re-start with the new frame? I presume they don't pile up in a buffer somewhere ... > Now, what rate() does is fairly simple. It could be written in Python (snip) > while (delay - (time.time() - origin) > 0): > pass > origin = time.time() (snip) > > The reason this can still have an effect when your "loop rate" is less > than N, because your loop will not execute in exactly the same wall > clock time each time, and rate() does not attempt to average across > iterations. > > For example, let's say N = 50, and your loop (without the call to > rate()) takes 10ms for every even iteration and 30ms for every odd > iteration. On each even iteration, rate() will sleep for 10ms, so that > that iteration takes 20ms. On odd iterations it will not sleep at all. > The net effect is that the frame rate changes from 50 (20ms average) to > 40 (25ms average). Interestingly, replacing the rate() call in my previous program with a spin-loop of the short you mentioned above (but based on time.clock(), which on Windows is supposed to be accurate down to microseconds), I still get the stair-stepping ... which I don't understand. I believe the above explanation will, at most, provide only a single plateau. Or perhaps I misunderstood something ... Gary strang-@at@-nmr.mgh.harvard.edu |
From: David S. <dsc...@vi...> - 2002-06-21 19:46:15
|
First of all, keep in mind that there are two rates involved: - How many times per second VPython's background rendering thread can draw the scene with OpenGL. (the "frame rate") - How many times per second your while loop executes ("loop rate" or "update rate") These two numbers can be entirely different. Your program measures the second, which is also what rate() controls. There is no way to change the rendering frame rate in VPython (except to buy a faster computer :), and VPython keeps rendering the screen even when there is no mouse input and no updates by the program. Now, what rate() does is fairly simple. It could be written in Python something like this (with some error checking and so on omitted): origin = time.time() def rate(N): global origin delay = 1.0 / N float t = delay - (time.time() - origin) if t > 0.010: time.sleep(t) else: while (delay - (time.time() - origin) > 0): pass origin = time.time() Essentially, it just sleeps or wastes CPU time until the previous iteration of the loop took at least 1/N seconds. The reason this can still have an effect when your "loop rate" is less than N, because your loop will not execute in exactly the same wall clock time each time, and rate() does not attempt to average across iterations. For example, let's say N = 50, and your loop (without the call to rate()) takes 10ms for every even iteration and 30ms for every odd iteration. On each even iteration, rate() will sleep for 10ms, so that that iteration takes 20ms. On odd iterations it will not sleep at all. The net effect is that the frame rate changes from 50 (20ms average) to 40 (25ms average). Another factor is that the operating system's Sleep() function is extremely inaccurate. The time slices used by Windows are often on the order of 15ms, which is quite a large margin of error in the type of test you are doing. This likely accounts for the "stairstepping" effect you are seeing, and it might also account for some of the variation. The reason the function above uses an inefficient spin loop for sleeps less than 10ms is that for such lengths of time, the average time taken by a Sleep can be a large factor different than the number passed to it. Hope that helps. I haven't actually done any experiments to confirm these hypotheses, so take them with a grain of salt. Dave > -----Original Message----- > From: vis...@li... > [mailto:vis...@li...] On > Behalf Of Gary Strangman > Sent: Friday, June 21, 2002 1:58 PM > To: Bruce Sherwood > Cc: vis...@li... > Subject: Re: [Visualpython-users] rate() function > > > > For what it's worth, this _only_ happens when the computer > can't keep up (like, when drawing 500 background objects). > When the computer is able to keep up, a rate(n) gives an > actual framerate of n (or very slightly less, thanks to > random background processes. > > > Many thanks for offering this analysis tool. It sure looks like > > something > > is very wrong with the rate machinery. A quick look at the > Visual code > > indicates that rate ought to work fine, but it most > assuredly isn't working > > fine, as you show conclusively. > > > > Bruce Sherwood > > > > At 11:35 AM 02/06/21 -0400, Gary Strangman wrote: > > > > >Hi all, > > > > > >This might be a bit off-topic--perhaps hardware > related(?)--but does > > >anyone know exactly what happens when you pick value of N > such that > > >your computer can't handle a given "rate(N)" visualpython > statement? > > >Do frames get dropped? Or is it dependent on one's > graphics card, or > > >screen refresh rates, or openGL implementation? Using the program > > >below, my _actual_ framerate increases as a stair-stepped > function of > > >the _specified_ framerate. What I find odd is that the _actual_ > > >framerate does keep on increasing. That is, rate(50) > doesn't give me > > >a 50Hz frame rate, but (according to my loop anyway) using > rate(100) > > >gives me a better than 50Hz frame rate. I would think that > the actual > > >framerate should increase linearly to the point where > one's computer > > >is maxed out, and then plateau indefinitely. Apparently > that's naive. > > >Any ideas? I've tested this on both a couple machines (though both > > >are portables with, of course, LCD monitors). > > > > > >Thanks in advance for any guesses (or better yet, answers) ... > > > > > >Gary > > >strang-@at@-nmr.mgh.harvard.edu > > > > > >--- cut here --- > > > > > >from visual import * > > >import time, sys, whrandom > > > > > >scene.title = "Speed test" > > ># Create 2 frames > > >fworld = frame(pos=(0,0,0)) > > >ftarget = frame(frame=fworld,pos=(0,0,0)) > > >ftarget.pos = (0,0,0) > > >fworld.pos = (0,0,10) > > > > > ># Draw some main objects > > >body = cylinder(frame=ftarget, pos=(0,0,0), axis=(0,0,0.35), > > >radius=1, > > >color=(0,0,1),visible=1) > > >pin = cylinder(frame=ftarget, pos=(0,1,0), axis=(0,1,0), radius=1, > > >color=(1,1,1),visible=1) > > >pinball = sphere(frame=ftarget, pos=(0,-1,0), radius=1, > > >color=(1,1,0),visible=1) > > >topbox = box(frame=ftarget, pos=(0,0.34,0.20), axis=(0,1,0), > > >length=0.2,width=0.1,height=0.1, color=(1,0,0),visible=1) > > >horizon = cylinder(frame=ftarget, pos=(-5,2,0), > axis=(10,0,0), radius=1, > > >color=(0,1,0),visible=1) > > > > > >xINC = 0 > > >yINC = 0.001 > > >zINC = 0.003 > > >rollINC = 0 > > >pitchINC = 0 > > >yawINC = 0 > > >scene.autoscale = 0 > > >NUM_DOTS = 500 > > >RADIUS = 120 > > >rad = 0.4 > > ># now draw background objects > > >for i in range(0, NUM_DOTS): > > > x = whrandom.random() - 0.5 > > > y = whrandom.random() - 0.5 > > > z = whrandom.random() - 0.5 > > > length = math.sqrt(x*x + y*y + z*z) > > > x = x / length * RADIUS > > > y = y / length * RADIUS + 1.8 > > > z = z / length * RADIUS > > > sphere(pos=(x,y,z),radius=rad) > > > > > >frameratelist = [] > > >for framerate in range(10,250,1): > > > framecount = 0 > > > starttime = time.clock() > > > while framecount<5*framerate: # integrate over, > theoretically, 5sec > > > rate(framerate) > > > framecount += 1 > > > fworld.pos.x -= xINC > > > fworld.pos.y -= yINC > > > fworld.pos.z = framecount*zINC > > > > > > # Rotate "CAMERA" (actually, move whole _world_ > around camera) > > > fworld.rotate(angle=pitchINC, axis=(1,0,0), > > > origin=scene.mouse.camera) > > > fworld.rotate(angle=yawINC, axis=(0,1,0), > origin=scene.mouse.camera) > > > fworld.rotate(angle=rollINC, axis=(0,0,1), > origin=scene.mouse.camera) > > > endtime = time.clock() > > > print "Rate(%i): %i frames in %2.2f sec = %2.2f frames/sec" % > > > (framerate, framecount, (endtime-starttime), > framecount/(endtime-starttime)) > > > frameratelist.append((framerate, framecount, > (endtime-starttime), > > > framecount/(endtime-starttime))) > > > > > > > > > > > >------------------------------------------------------- > > >Sponsored by: > > >ThinkGeek at http://www.ThinkGeek.com/ > > >_______________________________________________ > > >Visualpython-users mailing list > > >Vis...@li... > > >https://lists.sourceforge.net/lists/listinfo/visualpython-users > > > > > > > > > > ------------------------------------------------------- > Sponsored by: > ThinkGeek at http://www.ThinkGeek.com/ > _______________________________________________ > Visualpython-users mailing list > Vis...@li... > https://lists.sourceforge.net/lists/listinfo/visualpython-users > |
From: Gary S. <st...@nm...> - 2002-06-21 17:58:44
|
For what it's worth, this _only_ happens when the computer can't keep up (like, when drawing 500 background objects). When the computer is able to keep up, a rate(n) gives an actual framerate of n (or very slightly less, thanks to random background processes. > Many thanks for offering this analysis tool. It sure looks like something > is very wrong with the rate machinery. A quick look at the Visual code > indicates that rate ought to work fine, but it most assuredly isn't working > fine, as you show conclusively. > > Bruce Sherwood > > At 11:35 AM 02/06/21 -0400, Gary Strangman wrote: > > >Hi all, > > > >This might be a bit off-topic--perhaps hardware related(?)--but does > >anyone know exactly what happens when you pick value of N such that your > >computer can't handle a given "rate(N)" visualpython statement? Do frames > >get dropped? Or is it dependent on one's graphics card, or screen refresh > >rates, or openGL implementation? Using the program below, my _actual_ > >framerate increases as a stair-stepped function of the _specified_ > >framerate. What I find odd is that the _actual_ framerate does keep on > >increasing. That is, rate(50) doesn't give me a 50Hz frame rate, but > >(according to my loop anyway) using rate(100) gives me a better than 50Hz > >frame rate. I would think that the actual framerate should increase > >linearly to the point where one's computer is maxed out, and then plateau > >indefinitely. Apparently that's naive. Any ideas? I've tested this on both > >a couple machines (though both are portables with, of course, LCD > >monitors). > > > >Thanks in advance for any guesses (or better yet, answers) ... > > > >Gary > >strang-@at@-nmr.mgh.harvard.edu > > > >--- cut here --- > > > >from visual import * > >import time, sys, whrandom > > > >scene.title = "Speed test" > ># Create 2 frames > >fworld = frame(pos=(0,0,0)) > >ftarget = frame(frame=fworld,pos=(0,0,0)) > >ftarget.pos = (0,0,0) > >fworld.pos = (0,0,10) > > > ># Draw some main objects > >body = cylinder(frame=ftarget, pos=(0,0,0), axis=(0,0,0.35), radius=1, > >color=(0,0,1),visible=1) > >pin = cylinder(frame=ftarget, pos=(0,1,0), axis=(0,1,0), radius=1, > >color=(1,1,1),visible=1) > >pinball = sphere(frame=ftarget, pos=(0,-1,0), radius=1, > >color=(1,1,0),visible=1) > >topbox = box(frame=ftarget, pos=(0,0.34,0.20), axis=(0,1,0), > >length=0.2,width=0.1,height=0.1, color=(1,0,0),visible=1) > >horizon = cylinder(frame=ftarget, pos=(-5,2,0), axis=(10,0,0), radius=1, > >color=(0,1,0),visible=1) > > > >xINC = 0 > >yINC = 0.001 > >zINC = 0.003 > >rollINC = 0 > >pitchINC = 0 > >yawINC = 0 > >scene.autoscale = 0 > >NUM_DOTS = 500 > >RADIUS = 120 > >rad = 0.4 > ># now draw background objects > >for i in range(0, NUM_DOTS): > > x = whrandom.random() - 0.5 > > y = whrandom.random() - 0.5 > > z = whrandom.random() - 0.5 > > length = math.sqrt(x*x + y*y + z*z) > > x = x / length * RADIUS > > y = y / length * RADIUS + 1.8 > > z = z / length * RADIUS > > sphere(pos=(x,y,z),radius=rad) > > > >frameratelist = [] > >for framerate in range(10,250,1): > > framecount = 0 > > starttime = time.clock() > > while framecount<5*framerate: # integrate over, theoretically, 5sec > > rate(framerate) > > framecount += 1 > > fworld.pos.x -= xINC > > fworld.pos.y -= yINC > > fworld.pos.z = framecount*zINC > > > > # Rotate "CAMERA" (actually, move whole _world_ around camera) > > fworld.rotate(angle=pitchINC, axis=(1,0,0), > > origin=scene.mouse.camera) > > fworld.rotate(angle=yawINC, axis=(0,1,0), origin=scene.mouse.camera) > > fworld.rotate(angle=rollINC, axis=(0,0,1), origin=scene.mouse.camera) > > endtime = time.clock() > > print "Rate(%i): %i frames in %2.2f sec = %2.2f frames/sec" % > > (framerate, framecount, (endtime-starttime), framecount/(endtime-starttime)) > > frameratelist.append((framerate, framecount, (endtime-starttime), > > framecount/(endtime-starttime))) > > > > > > > >------------------------------------------------------- > >Sponsored by: > >ThinkGeek at http://www.ThinkGeek.com/ > >_______________________________________________ > >Visualpython-users mailing list > >Vis...@li... > >https://lists.sourceforge.net/lists/listinfo/visualpython-users > > > |
From: Bruce S. <bas...@un...> - 2002-06-21 17:53:34
|
Many thanks for offering this analysis tool. It sure looks like something is very wrong with the rate machinery. A quick look at the Visual code indicates that rate ought to work fine, but it most assuredly isn't working fine, as you show conclusively. Bruce Sherwood At 11:35 AM 02/06/21 -0400, Gary Strangman wrote: >Hi all, > >This might be a bit off-topic--perhaps hardware related(?)--but does >anyone know exactly what happens when you pick value of N such that your >computer can't handle a given "rate(N)" visualpython statement? Do frames >get dropped? Or is it dependent on one's graphics card, or screen refresh >rates, or openGL implementation? Using the program below, my _actual_ >framerate increases as a stair-stepped function of the _specified_ >framerate. What I find odd is that the _actual_ framerate does keep on >increasing. That is, rate(50) doesn't give me a 50Hz frame rate, but >(according to my loop anyway) using rate(100) gives me a better than 50Hz >frame rate. I would think that the actual framerate should increase >linearly to the point where one's computer is maxed out, and then plateau >indefinitely. Apparently that's naive. Any ideas? I've tested this on both >a couple machines (though both are portables with, of course, LCD >monitors). > >Thanks in advance for any guesses (or better yet, answers) ... > >Gary >strang-@at@-nmr.mgh.harvard.edu > >--- cut here --- > >from visual import * >import time, sys, whrandom > >scene.title = "Speed test" ># Create 2 frames >fworld = frame(pos=(0,0,0)) >ftarget = frame(frame=fworld,pos=(0,0,0)) >ftarget.pos = (0,0,0) >fworld.pos = (0,0,10) > ># Draw some main objects >body = cylinder(frame=ftarget, pos=(0,0,0), axis=(0,0,0.35), radius=1, >color=(0,0,1),visible=1) >pin = cylinder(frame=ftarget, pos=(0,1,0), axis=(0,1,0), radius=1, >color=(1,1,1),visible=1) >pinball = sphere(frame=ftarget, pos=(0,-1,0), radius=1, >color=(1,1,0),visible=1) >topbox = box(frame=ftarget, pos=(0,0.34,0.20), axis=(0,1,0), >length=0.2,width=0.1,height=0.1, color=(1,0,0),visible=1) >horizon = cylinder(frame=ftarget, pos=(-5,2,0), axis=(10,0,0), radius=1, >color=(0,1,0),visible=1) > >xINC = 0 >yINC = 0.001 >zINC = 0.003 >rollINC = 0 >pitchINC = 0 >yawINC = 0 >scene.autoscale = 0 >NUM_DOTS = 500 >RADIUS = 120 >rad = 0.4 ># now draw background objects >for i in range(0, NUM_DOTS): > x = whrandom.random() - 0.5 > y = whrandom.random() - 0.5 > z = whrandom.random() - 0.5 > length = math.sqrt(x*x + y*y + z*z) > x = x / length * RADIUS > y = y / length * RADIUS + 1.8 > z = z / length * RADIUS > sphere(pos=(x,y,z),radius=rad) > >frameratelist = [] >for framerate in range(10,250,1): > framecount = 0 > starttime = time.clock() > while framecount<5*framerate: # integrate over, theoretically, 5sec > rate(framerate) > framecount += 1 > fworld.pos.x -= xINC > fworld.pos.y -= yINC > fworld.pos.z = framecount*zINC > > # Rotate "CAMERA" (actually, move whole _world_ around camera) > fworld.rotate(angle=pitchINC, axis=(1,0,0), > origin=scene.mouse.camera) > fworld.rotate(angle=yawINC, axis=(0,1,0), origin=scene.mouse.camera) > fworld.rotate(angle=rollINC, axis=(0,0,1), origin=scene.mouse.camera) > endtime = time.clock() > print "Rate(%i): %i frames in %2.2f sec = %2.2f frames/sec" % > (framerate, framecount, (endtime-starttime), framecount/(endtime-starttime)) > frameratelist.append((framerate, framecount, (endtime-starttime), > framecount/(endtime-starttime))) > > > >------------------------------------------------------- >Sponsored by: >ThinkGeek at http://www.ThinkGeek.com/ >_______________________________________________ >Visualpython-users mailing list >Vis...@li... >https://lists.sourceforge.net/lists/listinfo/visualpython-users |
From: Bruce S. <bas...@un...> - 2002-06-21 17:00:13
|
I haven't used a debugger with VPython, but I believe that adding debugging facilities to IDLE is an active area of development in the sourceforge.net "idlefork" project, which was initiated from the IDLE that is included with VPython. However, if you report what kind of failures and error messages you're getting from VPython demo programs, someone might recognize a pattern. I believe it is the case that people have gotten VPython to run in the SuSE environment. Bruce At 08:54 AM 02/06/21 +0200, Nils Wagner wrote: >Hi all, > >I have installed visualpython via CVS on SuSE8.0. However, many of >the demo programs failed. How can I invoke a debugging program to locate >the >problems ? > >Nils > > >------------------------------------------------------- >Sponsored by: >ThinkGeek at http://www.ThinkGeek.com/ >_______________________________________________ >Visualpython-users mailing list >Vis...@li... >https://lists.sourceforge.net/lists/listinfo/visualpython-users |
From: Gary S. <st...@nm...> - 2002-06-21 15:35:29
|
Hi all, This might be a bit off-topic--perhaps hardware related(?)--but does anyone know exactly what happens when you pick value of N such that your computer can't handle a given "rate(N)" visualpython statement? Do frames get dropped? Or is it dependent on one's graphics card, or screen refresh rates, or openGL implementation? Using the program below, my _actual_ framerate increases as a stair-stepped function of the _specified_ framerate. What I find odd is that the _actual_ framerate does keep on increasing. That is, rate(50) doesn't give me a 50Hz frame rate, but (according to my loop anyway) using rate(100) gives me a better than 50Hz frame rate. I would think that the actual framerate should increase linearly to the point where one's computer is maxed out, and then plateau indefinitely. Apparently that's naive. Any ideas? I've tested this on both a couple machines (though both are portables with, of course, LCD monitors). Thanks in advance for any guesses (or better yet, answers) ... Gary strang-@at@-nmr.mgh.harvard.edu --- cut here --- from visual import * import time, sys, whrandom scene.title = "Speed test" # Create 2 frames fworld = frame(pos=(0,0,0)) ftarget = frame(frame=fworld,pos=(0,0,0)) ftarget.pos = (0,0,0) fworld.pos = (0,0,10) # Draw some main objects body = cylinder(frame=ftarget, pos=(0,0,0), axis=(0,0,0.35), radius=1, color=(0,0,1),visible=1) pin = cylinder(frame=ftarget, pos=(0,1,0), axis=(0,1,0), radius=1, color=(1,1,1),visible=1) pinball = sphere(frame=ftarget, pos=(0,-1,0), radius=1, color=(1,1,0),visible=1) topbox = box(frame=ftarget, pos=(0,0.34,0.20), axis=(0,1,0), length=0.2,width=0.1,height=0.1, color=(1,0,0),visible=1) horizon = cylinder(frame=ftarget, pos=(-5,2,0), axis=(10,0,0), radius=1, color=(0,1,0),visible=1) xINC = 0 yINC = 0.001 zINC = 0.003 rollINC = 0 pitchINC = 0 yawINC = 0 scene.autoscale = 0 NUM_DOTS = 500 RADIUS = 120 rad = 0.4 # now draw background objects for i in range(0, NUM_DOTS): x = whrandom.random() - 0.5 y = whrandom.random() - 0.5 z = whrandom.random() - 0.5 length = math.sqrt(x*x + y*y + z*z) x = x / length * RADIUS y = y / length * RADIUS + 1.8 z = z / length * RADIUS sphere(pos=(x,y,z),radius=rad) frameratelist = [] for framerate in range(10,250,1): framecount = 0 starttime = time.clock() while framecount<5*framerate: # integrate over, theoretically, 5sec rate(framerate) framecount += 1 fworld.pos.x -= xINC fworld.pos.y -= yINC fworld.pos.z = framecount*zINC # Rotate "CAMERA" (actually, move whole _world_ around camera) fworld.rotate(angle=pitchINC, axis=(1,0,0), origin=scene.mouse.camera) fworld.rotate(angle=yawINC, axis=(0,1,0), origin=scene.mouse.camera) fworld.rotate(angle=rollINC, axis=(0,0,1), origin=scene.mouse.camera) endtime = time.clock() print "Rate(%i): %i frames in %2.2f sec = %2.2f frames/sec" % (framerate, framecount, (endtime-starttime), framecount/(endtime-starttime)) frameratelist.append((framerate, framecount, (endtime-starttime), framecount/(endtime-starttime))) |
From: Nils W. <nw...@me...> - 2002-06-21 06:49:02
|
Hi all, I have installed visualpython via CVS on SuSE8.0. However, many of the demo programs failed. How can I invoke a debugging program to locate the problems ? Nils |
From: Bruce S. <bas...@un...> - 2002-06-21 03:43:54
|
Thanks for the pipe examples. Minor point: there's no need to import Numeric explicitly, as it is imported by Visual. Bruce Sherwood |
From: Dockeen <do...@mc...> - 2002-06-21 03:33:34
|
Yes, I realize I could have done it with long rectanges from end to end. I am working towards something, and I was curious... Waynebozo |
From: Dockeen <do...@mc...> - 2002-06-21 03:26:30
|
I am obviously way too stressed out after a couple of high stress 13 hour days in the lab. I know I should not specify colors the way I did. I just find it so neat you can extract the axis of an object by simple specifying object.axis. Here it is, very 60's cylinder from visual import * from Numeric import * length = 3.0 radius = 1.0 number_of_steps_length = 20 number_of_angle_steps = 20 length_step = length / number_of_steps_length angle_step = 2.0 * 3.1415926 / number_of_angle_steps scene = display(title='Cylinder', width=500, height=500, center=(0,0,0), range=(5,5,5)) f = frame() for i in xrange(0,number_of_steps_length): x1 = i * length_step x2 = (i + 1) * length_step for j in xrange(0,number_of_angle_steps): theta = j * angle_step y1 = radius * sin(theta) z1 = radius * cos(theta) y2 = radius * sin(theta + angle_step) z2 = radius * cos(theta + angle_step) convex(frame = f,pos = [(x1,y1,z1),(x1,y2,z2),(x2,y1,z1),(x2,y2,z2)],color = (x1,y1,z1)) for i in xrange(1,200): rate(5) f.rotate(angle = 0.02,axis = (0,1,0),origin = (0,0,0)) f.rotate(angle = -0.1,axis=f.axis,origin = (0,0,0)) Wayne Keen |
From: Dockeen <do...@mc...> - 2002-06-21 03:03:19
|
I haven't had as much chance as I would like in a while, so I figured I would take a quick shot at a cylinder example. I did not write comments, but I think the code is fairly simple. It is crude, but it works. from visual import * from Numeric import * length = 3.0 radius = 1.0 number_of_steps_length = 30 number_of_angle_steps = 30 length_step = length / number_of_steps_length angle_step = 2.0 * 3.1415926 / number_of_angle_steps scene = display(title='Cylinder', width=500, height=500, center=(0,0,0), range=(5,5,5)) for i in xrange(0,number_of_steps_length): x1 = i * length_step x2 = (i + 1) * length_step for j in xrange(0,number_of_angle_steps): theta = j * angle_step y1 = radius * sin(theta) z1 = radius * cos(theta) y2 = radius * sin(theta + angle_step) z2 = radius * cos(theta + angle_step) convex(pos = [(x1,y1,z1),(x1,y2,z2),(x2,y1,z1),(x2,y2,z2)], color = color.red) Have fun, you just GOTTA love this tool! Wayne Keen |
From: Bruce S. <bas...@un...> - 2002-06-20 03:28:03
|
Not frame, which is a mechanism for grouping objects together. You can get a corrugated pipe by stacking a bunch of rings: for x in arange(-1, 1, 0.1): ring(pos=(x,0,0), radius=0.5, thickness=0.1, color=color.cyan) To get a nice clean pipe at present would require using the faces object to do it all yourself (by splitting the object into a large number of triangles). Bruce Sherwood At 03:25 PM 02/06/19 -0700, IVES,THOM (HP-Boise,ex1) wrote: >New guy here, > >How would you make a hole down the axis of a cylinder to create a pipe? >Frame somehow? I'd really like to be able to see through it. > >Thom > >Thom Ives |
From: IVES,THOM (HP-Boise,ex1) <tho...@hp...> - 2002-06-19 22:25:54
|
New guy here, How would you make a whole down the axis of a cylinder to create a pipe? Frame somehow? I'd really like to be able to see through it. Thom Thom Ives |
From: IVES,THOM (HP-Boise,ex1) <tho...@hp...> - 2002-06-19 17:12:02
|
New guy here, How would you make a whole down the axis of a cylinder to create a pipe? Frame somehow? I'd really like to be able to see through it. Thom Thom Ives |
From: M. L. M. <lei...@Gl...> - 2002-06-18 14:13:22
|
On Sat, 15 Jun 2002 vis...@li... wrote: > Message: 1 > Date: Fri, 14 Jun 2002 17:32:59 -0400 > To: VPython User Group <vis...@li...> > From: Bruce Sherwood <bas...@un...> > Subject: [Visualpython-users] Frame documentation > > Added documentation of frame.objects to the frame documentation available > on the web site and in the documentation download. > > Also fixed a typo in the venerable demo program bounce2.py, which changed > the z component of velocity when the y wall was hit. Amazing that it went > unnoticed all this time. > I actually noticed that last week when I was going through those demos to learn vpython. Since I'm just starting vpython I didn't know if it was something I didn't understand or if it was a typo. Leila |
From: Bruce S. <bas...@un...> - 2002-06-18 03:03:00
|
Very pretty! After establishing the basic elements of the scene, execute "scene.autoscale = 0". The problem is that VPython attempts to move the camera to ensure that all of the scene is visible at all times. The algorithm isn't perfect, so you get some "breathing" in some situations. Bruce Sherwood At 08:44 PM 02/06/17 -0400, Eric Hagemann wrote: >Hey all, > > First off I gotta say this is cool stuff !! > > Wrote a quick example (included below), can some on help with the >problme of "breathing" ? If you run the example you will notice the outer >ring changed size based on the orientation of the other rings. Is there a >way to stop this auto scaling ? > >Cheers >Eric |
From: Eric H. <eha...@co...> - 2002-06-18 00:44:21
|
Hey all, First off I gotta say this is cool stuff !! Wrote a quick example (included below), can some on help with the problme of "breathing" ? If you run the example you will notice the outer ring changed size based on the orientation of the other rings. Is there a way to stop this auto scaling ? Cheers Eric from visual import * org=(1,1,1) o_ring = ring(pos=org,axis=(0,1,0),radius=2.0,thickness=0.5,color=color.blue) m_ring = ring(pos=org,axis=(1,0,0),radius=1.0,thickness=0.5,color=color.red) i_ring = ring(pos=org,axis=(0,0,1),radius=3.0,thickness=0.5,color=color.green) f_ring = ring(pos=org,axis=(0,0,1),radius=4.0,thickness=0.5,color=color.white) while 1: o_ring.rotate(angle=pi/180.,axis=(1,1,0),origin=org) m_ring.rotate(angle=pi/180.,axis=(1,0,1),origin=org) i_ring.rotate(angle=pi/180.,axis=(0,1,1),origin=org) rate(20) |
From: Bruce S. <bas...@un...> - 2002-06-17 12:50:19
|
From your description it sounds like you are creating arrows inside your main loop. Instead, create the arrows just once, before entering the main loop. Then as the magnetic field changes, continually alter the axis attributes of the arrows. Here's the basic outline: Barrow = arrow(pos=(x1,y1,z)) while 1: # calculate mag. field B as a vector Barrow.axis = scalefactor*B # alter the axis of the Barrow object For an example of this, see the VPython demo program toroid_drag.py. If on the other hand you create the arrow object inside the loop, each time that you create it the old one becomes a (visible) orphan on the screen, and the new arrow is displayed. And if you try to make this arrow invisible, the old orphaned arrow objects will still be visible, since the name "Barrow" has been removed from the old arrows and currently references the most recently created object. If I've misdiagnosed the problem, please show us the relevant portion of your program. Bruce Sherwood At 12:13 AM 02/06/17 -0400, Karim Diff wrote: >This question may have been addressed before, but I am >new to vpython and I have not found the answer so far: >I am drawing vectors representing the magnetic field surrounding a moving >charge but at every iteration my program draws the new vectors on top of >the previous ones. I would like to be able to draw only the current >vectors. Is there a way of "refreshing" the display as in Java? >I tried to tinker with the visible attribute of my vectors (trying to turn >"visible" on and off) but it did not work. >Thanks for any pointers. > >Karim Diff |
From: Karim D. <kar...@sa...> - 2002-06-17 04:13:31
|
This question may have been addressed before, but I am new to vpython and I have not found the answer so far: I am drawing vectors representing the magnetic field surrounding a = moving charge but at every iteration my program draws the new vectors on = top of the previous ones. I would like to be able to draw only the = current vectors. Is there a way of "refreshing" the display as in Java? I tried to tinker with the visible attribute of my vectors (trying to = turn "visible" on and off) but it did not work. Thanks for any pointers. Karim Diff |
From: Bruce S. <bas...@un...> - 2002-06-14 21:37:18
|
Added documentation of frame.objects to the frame documentation available on the web site and in the documentation download. Also fixed a typo in the venerable demo program bounce2.py, which changed the z component of velocity when the y wall was hit. Amazing that it went unnoticed all this time. Also updated the full Windows installer, but not those for Mac and Linux. Bruce Sherwood |
From: Toan N. <ttn...@ph...> - 2002-06-13 22:14:31
|
Thanks. That works for me. On Thu, 13 Jun 2002, Bruce Sherwood wrote: > There is a simpler way to make all the objects in a frame be > invisible: > > f = frame() > ball = sphere(frame=f) > carton = box() > for obj in f.objects: > obj.visible = 0 > > I see that there is something missing from the Visual documentation -- > it doesn't tell you that "objects" is an attribute of a frame. I'll > fix that. > > Bruce Sherwood > > > _______________________________________________________________ > > Don't miss the 2002 Sprint PCS Application Developer's Conference > August 25-28 in Las Vegas - http://devcon.sprintpcs.com/adp/index.cfm?source=osdntextlink > > _______________________________________________ > Visualpython-users mailing list > Vis...@li... > https://lists.sourceforge.net/lists/listinfo/visualpython-users > |
From: Bruce S. <bas...@un...> - 2002-06-13 21:48:34
|
There is a simpler way to make all the objects in a frame be invisible: f = frame() ball = sphere(frame=f) carton = box() for obj in f.objects: obj.visible = 0 I see that there is something missing from the Visual documentation -- it doesn't tell you that "objects" is an attribute of a frame. I'll fix that. Bruce Sherwood |
From: Bruce S. <bas...@un...> - 2002-06-13 12:54:15
|
I think it is indeed the case that there isn't any way to add an existing object to a frame. I'm also not quite sure what it would mean, or what the syntax would look like, since the point of a frame is that coordinates are relative to the frame. How should the existing coordinates be interpreted when adding to a frame? As for making all objects in a frame invisible by scene.frame.visible = 0, the fact that this doesn't work is in fact a bug and is on the bug list in the VPython project at sourceforge.net. You can achieve the effect however by looping through the objects: f = frame() ball = sphere(frame=f) carton = box() for obj in scene.objects: if obj.frame is f: obj.visible = 0 |
From: Toan N. <ttn...@ph...> - 2002-06-12 18:19:46
|
Hello, I have two questions: 1. How to add an existing object into a frame object? The example in the reference manual about frame specifies how to creat a NEW object and insert into an existing frame. I want to insert an EXISTING object into a frame. 2. How to make a frame (and all objects in it) invisible? The usual command object.visible = 0 doesn't work for me. Helps are greatly appreciated. Toan |
From: Bruce S. <bas...@un...> - 2002-06-06 00:31:43
|
No, there isn't, but it would be pretty easy to write small subroutines that would do what you want to do, if sliding is what you want. Note that just placing the camera will never be very useful; you do have to specify the point looked at as well. So there isn't really much alternative to having to update both center and forward. Bruce Sherwood At 12:30 PM 02/06/05 -0400, Gary Strangman wrote: >Hi, > >Is there currently a way to _directly_ specify the camera position? Camera >position (scene.mouse.camera) can certainly be modified via scene.center >and scene.forward, but this is rather indirect and awkward if you want to, >say, just slide the camera left or right or up or down. > >Gary > > >_______________________________________________________________ > >Don't miss the 2002 Sprint PCS Application Developer's Conference >August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm > >_______________________________________________ >Visualpython-users mailing list >Vis...@li... >https://lists.sourceforge.net/lists/listinfo/visualpython-users |