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...> - 2011-10-24 20:50:37
|
Thanks! I've installed your patch in materials.py and rebuilt VPython 5.72, which was only a few days old. Bruce Sherwood On Sat, Oct 22, 2011 at 6:50 AM, Jason Morgan <j.a...@gm...> wrote: > Hi, > There is a bug in vpython where it fails with py2exe. > > The problem is that it fails to find the texture bitmap files and raises an > exception. > > I can see that it is because Visual loads a number of texture bitmaps in > vis/material.py regardless of even if material are being used (for me they > are not). > Then to make matters worse they don't seem to be referred to in such a way > as is compatible with py2exe. > > It seems the use of __file__ to find the location of the module in > materials.py is not very portable as __file__ becomes the name of the .exe > when compiled into a standalone program. > > I have found that you can modify materials.py, at about line 151, thus: > > ... > import sys > if hasattr(sys,'frozen') and (sys.frozen=="windows_exe" or > sys.frozen=="console_exe"): > texturePath="visual\\" > else: > texturePath = os.path.split( __file__ )[0] + "/" > del sys > ... > > and then add to your setup.py something like: > > ... > import sys,glob > ... > visual_materials = ( r'visual', > glob.glob(sys.exec_prefix+'\\Lib\site-packages\\vis\\*.tga' )) > ... > setup( > data_files = [visual_materials], ...etc... > ... > > This creates a \visual\ folder in your distribution and that contains the > missing bitmaps. > > Please consider adding the above fix to the visual materials module. > > However I still don't think this is ideal. > I think it should be possible to use img2py (from wxPython) to embed the > images in a file if the code is frozen (i.e. has been .exe'd) > > A more impressive solution would be to make it such that they are only > loaded if an instance of a material that uses them is created, but I am not > confident with the inner workings of visual to make that so. > > Cheers, > Jason > > > > ------------------------------------------------------------------------------ > The demand for IT networking professionals continues to grow, and the > demand for specialized networking skills is growing even more rapidly. > Take a complimentary Learning@Cisco Self-Assessment and learn > about Cisco certifications, training, and career opportunities. > http://p.sf.net/sfu/cisco-dev2dev > _______________________________________________ > Visualpython-users mailing list > Vis...@li... > https://lists.sourceforge.net/lists/listinfo/visualpython-users > > |
From: Jason M. <j.a...@gm...> - 2011-10-22 13:17:24
|
Hi, There is a bug in vpython where it fails with py2exe. The problem is that it fails to find the texture bitmap files and raises an exception. I can see that it is because Visual loads a number of texture bitmaps in vis/material.py regardless of even if material are being used (for me they are not). Then to make matters worse they don't seem to be referred to in such a way as is compatible with py2exe. It seems the use of __file__ to find the location of the module in materials.py is not very portable as __file__ becomes the name of the .exe when compiled into a standalone program. I have found that you can modify materials.py, at about line 151, thus: ... import sys if hasattr(sys,'frozen') and (sys.frozen=="windows_exe" or sys.frozen=="console_exe"): texturePath="visual\\" else: texturePath = os.path.split( __file__ )[0] + "/" del sys ... and then add to your setup.py something like: ... import sys,glob ... visual_materials = ( r'visual', glob.glob(sys.exec_prefix+'\\Lib\site-packages\\vis\\*.tga' )) ... setup( data_files = [visual_materials], ...etc... ... This creates a \visual\ folder in your distribution and that contains the missing bitmaps. Please consider adding the above fix to the visual materials module. However I still don't think this is ideal. I think it should be possible to use img2py (from wxPython) to embed the images in a file if the code is frozen (i.e. has been .exe'd) A more impressive solution would be to make it such that they are only loaded if an instance of a material that uses them is created, but I am not confident with the inner workings of visual to make that so. Cheers, Jason |
From: Bruce S. <Bru...@nc...> - 2011-10-20 15:56:18
|
No, there isn't such a parameter available in VPython. We do internally use fewer triangles for objects that are farther away. Bruce Sherwood On Thu, Oct 20, 2011 at 7:53 AM, Andrew McCormick <agm...@gm...> wrote: > Bruce, > > I'm using vpython for displaying the results of simulations run in c++ -- > and it works great! My only issue is that as I get add more and more details > (i.e. have more objects in my model, or whatever), the display rate becomes > rather slow. Is there, a la OpenGL, parameters I can use to set the detail > level of each individual object so as to counteract this slowdown? I.e. draw > each cylinder using only 10 polygons instead of whatever the default is? I > haven't seen any such parameters when browsing through the documentation. > > Andrew > > > ------------------------------------------------------------------------------ > The demand for IT networking professionals continues to grow, and the > demand for specialized networking skills is growing even more rapidly. > Take a complimentary Learning@Ciosco Self-Assessment and learn > about Cisco certifications, training, and career opportunities. > http://p.sf.net/sfu/cisco-dev2dev > _______________________________________________ > Visualpython-users mailing list > Vis...@li... > https://lists.sourceforge.net/lists/listinfo/visualpython-users > > |
From: Andrew M. <agm...@gm...> - 2011-10-20 13:53:13
|
Bruce, I'm using vpython for displaying the results of simulations run in c++ -- and it works great! My only issue is that as I get add more and more details (i.e. have more objects in my model, or whatever), the display rate becomes rather slow. Is there, a la OpenGL, parameters I can use to set the detail level of each individual object so as to counteract this slowdown? I.e. draw each cylinder using only 10 polygons instead of whatever the default is? I haven't seen any such parameters when browsing through the documentation. Andrew |
From: Bruce S. <Bru...@nc...> - 2011-10-20 05:55:44
|
VPython 5.72 for Windows and Mac (no package for Linux yet): Corrects a rather serious bug in graphs where plotting (0,.001) followed by (.001,.001) failed to autoscale correctly. Also added documentation explaining what objects are used to represent gdots, gcurves, ghbars, and gvbars: If you say g = gcurve(), g.gcurve is a curve object used to represent the gcurve. If you say g = gdots(), g.dots is a points object used to represent the gdots. If you say g = gvbars(), g.vbars is a faces object used to represent the vbars. If you say g = ghbars(), g.hbars is a faces object used to represent the hbars. It was not possible at this time to work on various other bugs that have been reported, but they're not forgotten. Bruce Sherwood |
From: Shawn D. <sh...@ty...> - 2011-10-15 04:33:43
|
Poul wrote... > Yes, I know, but even the original example 'faces_heightfield' is > too complicated for me to see how I can add these colors. Can > someone give me just a little hint? Below is some added color. Search for “s.dube” -Shawn Dube from visual import * from time import * class Model: def __init__(self): self.frame = frame() self.model = faces(frame=self.frame, color=color.blue) self.vertices = [] def FacetedTriangle(self, v1, v2, v3, color=color.red): """Add a triangle to the model""" for v in (v1,v2,v3): self.vertices.append(v) def FacetedPolygon(self, *v): """Appends a planar polygon of any number of vertices to the model""" for t in range(len(v)-2): self.FacetedTriangle( v[0], v[t+1], v[t+2] ) self.FacetedTriangle( v[0], v[t+2], v[t+1] ) def DrawNormals(self, scale): pos = self.model.pos normal = self.model.normal for i in range(len(pos)): arrow(pos=pos[i], axis=normal[i]*scale) # function added by s.dube def PosArrayToHueColorArray( aPos, index ): # aPos is an array of positions # index chooses from which axis (x,y,z) to base color aPos= aPos.copy() v= hsplit(aPos,3)[index] v -= v.min() v *= 5.0 / v.max() # red r= v+1.0 r %= 6.0 r -= 3.0 r= abs(r) r -= 1.0 r= r.clip(0.0,1.0) # green g = v+3.0 g %= 6.0 g -= 3.0 g= abs(g) g -= 1.0 g= g.clip(0.0,1.0) # blue b= v b += 5.0 b %= 6.0 b -= 3.0 b= abs(b) b -= 1.0 b= b.clip(0.0,1.0) # wrap-up return hstack((r,g,b)) class Mesh (Model): def __init__(self, xvalues, yvalues, zvalues): global g Model.__init__(self) points = zeros( xvalues.shape + (3,), float ) points[...,0] = xvalues points[...,1] = yvalues points[...,2] = zvalues for i in range(zvalues.shape[0]-1): for j in range(zvalues.shape[1]-1): self.FacetedPolygon( points[i,j], points[i,j+1], points[i+1,j+1], points[i+1,j] ) self.model.pos = self.vertices self.model.color= PosArrayToHueColorArray( self.model.pos, 1 ) # added by s.dube self.model.make_normals() self.model.smooth() self.model.make_twosided() dxy=0.02 # Length of x-y-intervals x = arange(-1,1+dxy,dxy) y = arange(-1,1+dxy,dxy) d=0.8 # Distance between two oscillators dh=d/2 # Half that distance lambdah=d/5 # Wavelength k=2*pi/lambdah T=10 # Oscillator period A=0.025 # Oscillator amplitude omega=2*pi/T m1=12 #Number of wavelengths from oscillator 1 to point of constructive interference m2=10 #Number of wavelengths from oscillator 2 to point of constructive interference n=m1-m2 m=m2 xci=n*(n+2*m)*lambdah**2/2/d yci=sqrt((d**2-(n*lambdah)**2)*(((n+2*m)*lambdah)**2-d**2))/2/d print('Point of constructive interference: (',xci,yci,')') print(sqrt((xci-dh)**2+yci**2)/lambdah) print(sqrt((xci+dh)**2+yci**2)/lambdah) N1=m*20 N2=(m+n)*20 a1points=[] a2points=[] for i in range(0,N1+1): a1points.append((i*(xci-dh)/N1+dh,2*A*cos(i/N1*m*2*pi),1-i*yci/N1)) for i in range(0,N2+1): a2points.append((i*(xci+dh)/N2-dh,2*A*cos(i/N2*(m+n)*2*pi),1-i*yci/N2)) def f(x,y,t): return A*(sin(k*sqrt((x-dh)*(x-dh)+y*y)-omega*t)+sin(k*sqrt((x+dh)*(x+dh)+y*y)-omega*t)) source1=sphere(radius=0.02,pos=(dh,0,1),color=color.yellow) source2=sphere(radius=0.02,pos=(-dh,0,1),color=color.red) z = zeros( (len(x),len(y)), float ) x,y = x[:,None]+z, y+z curve(pos=a1points,color=color.red) curve(pos=a2points,color=color.yellow) Ncp=20 ncmax=floor(d/lambdah) if ncmax*lambdah==d: ncmax=ncmax-1 for nc in range(1,ncmax+1): bhyp=sqrt(-(nc*lambdah/2)**2+(d/2)**2) ahyp=bhyp*nc/sqrt(-nc*nc+(d/lambdah)**2) print('ahyp,bhyp:',ahyp,bhyp) txmax=acosh(1/ahyp) tymax=acosh(2/bhyp) tmax=txmax if tymax<txmax: tmax=tymax hyppoints=[] for i in range(0,Ncp+1): t=i*tmax/Ncp hyppoints.append((ahyp*cosh(t),2*A,-bhyp*sinh(t)+1)) curve(pos=hyppoints,color=color.green) hyppoints=[] for i in range(0,Ncp+1): t=i*tmax/Ncp hyppoints.append((-ahyp*cosh(t),2*A,-bhyp*sinh(t)+1)) curve(pos=hyppoints,color=color.green) hyppoints=[] hyppoints.append((0,2*A,-1)) hyppoints.append((0,2*A,1)) curve(pos=hyppoints,color=color.green) for i in range(0,100): surface=Mesh( x, f(x,y-1,i) , y ) #sleep(0.01) surface.model.visible=False del surface source1.pos=(-dh,-A*sin(omega*i),1) source2.pos=(dh,-A*sin(omega*i),1) i=100 surface=Mesh( x, f(x,y-1,i) , y ) |
From: Bruce S. <Bru...@nc...> - 2011-10-14 22:49:37
|
You're right, that 4th argument for FacetedTriangle isn't used and can be deleted. Or, if you want to call FacetedTriangle with both vertex locations and color specfications, you could revise the routine like this: def FacetedTriangle(self, v1, v2, v3, c1, c2, c3): self.vertices.append(pos=v1, color=c1) self.vertices.append(pos=v2, color=c2) self.vertices.append(pos=v3, color=c3) Then you would say self.FacetedTriangle(v1, v2, v3, c1, c2, c3). Bruce Sherwood On Fri, Oct 14, 2011 at 3:07 PM, Poul Riis <Pou...@sk...> wrote: > > Here is a small section of the original faces_heightfield example: > class Model: > def __init__(self): > self.frame = frame() > self.model = faces(frame=self.frame, color=color.cyan) > self.vertices = [] > def FacetedTriangle(self, v1, v2, v3, color=color.white): > """Add a triangle to the model""" > for v in (v1,v2,v3): > self.vertices.append(v) > I cannot see why the color=color.white is there - it seems to have no > effect!? Replacing white with red doesn't change anything. > Rather, I would like to input something like c1,c2,c3 (three colors for the > vertices) in the FacetedTriangle. But how exactly? > I regret that I'm such a poor programmer but it could be a great help if > someone would implement this change in faces_heightfield. > Poul Riis |
From: Poul R. <Pou...@sk...> - 2011-10-14 21:24:53
|
A little timetesting indicates that not the calculation of z-values but the drawing takes time.... Poul Riis |
From: Poul R. <Pou...@sk...> - 2011-10-14 21:08:15
|
Here is a small section of the original faces_heightfield example: class Model: def __init__(self): self.frame = frame() self.model = faces(frame=self.frame, color=color.cyan) self.vertices = [] def FacetedTriangle(self, v1, v2, v3, color=color.white): """Add a triangle to the model""" for v in (v1,v2,v3): self.vertices.append(v) I cannot see why the color=color.white is there - it seems to have no effect!? Replacing white with red doesn't change anything. Rather, I would like to input something like c1,c2,c3 (three colors for the vertices) in the FacetedTriangle. But how exactly? I regret that I'm such a poor programmer but it could be a great help if someone would implement this change in faces_heightfield. Poul Riis |
From: Bruce S. <Bru...@nc...> - 2011-10-14 19:51:02
|
I'm not sure what it is that you're asking about colors. Here is the key part of the documenation on the faces object: You can append additional vertices to an existing faces object with one of the following four forms (assuming the object is named f): f.append(pos=(x,y,z)) f.append(pos=(x,y,z), normal=(nx,ny,nz)) f.append(pos=(x,y,z), normal=(nx,ny,nz), color=(r,g,b)) f.append(pos=(x,y,z), normal=(nx,ny,nz), red=r, green=g, blue=b) Another convenient way to construct a faces object is to create a list or numpy array of positions, then create the faces object with the pos attribute set to the list or array. Then use make_normals(), make_twosided(), and smooth() to complete the task. On Fri, Oct 14, 2011 at 1:13 PM, Poul Riis <Pou...@sk...> wrote: > Bru...@nc... writes: > Also note that the > faces object lets you specify the colors of all vertices individually. > Yes, I know, but even the original example 'faces_heightfield' is too > complicated for me to see how I can add these colors. Can someone give me > just a little hint? > Poul Riis |
From: Poul R. <Pou...@sk...> - 2011-10-14 19:16:29
|
Bru...@nc... writes: >A general comment about speed is that if you can structure a program >to use the parallelism of numpy arrays you can get large speedups in >the computations Would it be possible that someone could rewrite the faces_heightfield-example using the numpy arrays? Poul Riis |
From: Poul R. <Pou...@sk...> - 2011-10-14 19:13:49
|
Bru...@nc... writes: >Also note that the >faces object lets you specify the colors of all vertices individually. Yes, I know, but even the original example 'faces_heightfield' is too complicated for me to see how I can add these colors. Can someone give me just a little hint? Poul Riis |
From: Bruce S. <Bru...@nc...> - 2011-10-14 18:39:23
|
Your program is too long and complex for me to comment on the speed issues. Concerning color, I'm not sure exactly what your issue is. You can calculate colors and then use them; for example you could do something like mycolor = (1,1,k*z), where k*z is between 0 and 1, and then set some object's color attribute to mycolor. Also note that the faces object lets you specify the colors of all vertices individually. A general comment about speed is that if you can structure a program to use the parallelism of numpy arrays you can get large speedups in the computations. Among the example programs that use this technique are gas, stars, and toroid_drag. However, numpy can be rather hard to use. Bruce Sherwood On Fri, Oct 14, 2011 at 2:22 AM, Poul Riis <Pou...@sk...> wrote: > Now it works! (please try my further developed example below). > However, it is far too slow. > Is there any possibility to speed it up? > How can I add colors depending on the z-value? > > Poul Riis > |
From: Poul R. <Pou...@sk...> - 2011-10-14 08:22:59
|
Now it works! (please try my further developed example below). However, it is far too slow. Is there any possibility to speed it up? How can I add colors depending on the z-value? Poul Riis from visual import * from time import * class Model: def __init__(self): self.frame = frame() self.model = faces(frame=self.frame, color=color.blue) self.vertices = [] def FacetedTriangle(self, v1, v2, v3, color=color.red): """Add a triangle to the model""" for v in (v1,v2,v3): self.vertices.append(v) def FacetedPolygon(self, *v): """Appends a planar polygon of any number of vertices to the model""" for t in range(len(v)-2): self.FacetedTriangle( v[0], v[t+1], v[t+2] ) self.FacetedTriangle( v[0], v[t+2], v[t+1] ) def DrawNormals(self, scale): pos = self.model.pos normal = self.model.normal for i in range(len(pos)): arrow(pos=pos[i], axis=normal[i]*scale) class Mesh (Model): def __init__(self, xvalues, yvalues, zvalues): Model.__init__(self) points = zeros( xvalues.shape + (3,), float ) points[...,0] = xvalues points[...,1] = yvalues points[...,2] = zvalues for i in range(zvalues.shape[0]-1): for j in range(zvalues.shape[1]-1): self.FacetedPolygon( points[i,j], points[i,j+1], points[i+1,j+1], points[i+1,j] ) self.model.pos = self.vertices self.model.make_normals() self.model.smooth() self.model.make_twosided() dxy=0.02 # Length of x-y-intervals x = arange(-1,1+dxy,dxy) y = arange(-1,1+dxy,dxy) d=0.8 # Distance between two oscillators dh=d/2 # Half that distance lambdah=d/5 # Wavelength k=2*pi/lambdah T=10 # Oscillator period A=0.025 # Oscillator amplitude omega=2*pi/T m1=12 #Number of wavelengths from oscillator 1 to point of constructive interference m2=10 #Number of wavelengths from oscillator 2 to point of constructive interference n=m1-m2 m=m2 xci=n*(n+2*m)*lambdah**2/2/d yci=sqrt((d**2-(n*lambdah)**2)*(((n+2*m)*lambdah)**2-d**2))/2/d print('Point of constructive interference: (',xci,yci,')') print(sqrt((xci-dh)**2+yci**2)/lambdah) print(sqrt((xci+dh)**2+yci**2)/lambdah) N1=m*20 N2=(m+n)*20 a1points=[] a2points=[] for i in range(0,N1+1): a1points.append((i*(xci-dh)/N1+dh,2*A*cos(i/N1*m*2*pi),1-i*yci/N1)) for i in range(0,N2+1): a2points.append((i*(xci+dh)/N2-dh,2*A*cos(i/N2*(m+n)*2*pi),1-i*yci/N2)) def f(x,y,t): return A*(sin(k*sqrt((x-dh)*(x-dh)+y*y)-omega*t)+sin(k*sqrt((x+dh)*(x+dh)+y*y)-omega*t)) source1=sphere(radius=0.02,pos=(dh,0,1),color=color.yellow) source2=sphere(radius=0.02,pos=(-dh,0,1),color=color.red) z = zeros( (len(x),len(y)), float ) x,y = x[:,None]+z, y+z curve(pos=a1points,color=color.red) curve(pos=a2points,color=color.yellow) Ncp=20 ncmax=floor(d/lambdah) if ncmax*lambdah==d: ncmax=ncmax-1 for nc in range(1,ncmax+1): bhyp=sqrt(-(nc*lambdah/2)**2+(d/2)**2) ahyp=bhyp*nc/sqrt(-nc*nc+(d/lambdah)**2) print('ahyp,bhyp:',ahyp,bhyp) txmax=acosh(1/ahyp) tymax=acosh(2/bhyp) tmax=txmax if tymax<txmax: tmax=tymax hyppoints=[] for i in range(0,Ncp+1): t=i*tmax/Ncp hyppoints.append((ahyp*cosh(t),2*A,-bhyp*sinh(t)+1)) curve(pos=hyppoints,color=color.green) hyppoints=[] for i in range(0,Ncp+1): t=i*tmax/Ncp hyppoints.append((-ahyp*cosh(t),2*A,-bhyp*sinh(t)+1)) curve(pos=hyppoints,color=color.green) hyppoints=[] hyppoints.append((0,2*A,-1)) hyppoints.append((0,2*A,1)) curve(pos=hyppoints,color=color.green) for i in range(0,100): surface=Mesh( x, f(x,y-1,i) , y ) #sleep(0.01) surface.model.visible=False del surface source1.pos=(-dh,-A*sin(omega*i),1) source2.pos=(dh,-A*sin(omega*i),1) i=100 surface=Mesh( x, f(x,y-1,i) , y ) |
From: Bruce S. <Bru...@nc...> - 2011-10-13 18:19:15
|
The problem is that you haven't made the objects invisible before deleting them. You have the statement "surface.visible = False", but surface is a Mesh object, which doesn't have a visible attribute. If you instead say "surface.model.visible = False", you make the faces object invisible, and then "del surface" works. Bruce Sherwood On Thu, Oct 13, 2011 at 12:24 AM, Poul Riis <Pou...@sk...> wrote: > > > Bru...@nc... writes: > To hide a Visual object just make it invisible: ball.visible = False. > This does not delete the object from computer memory, and you can make > it visible again later. > If however you later re-use the name ball, for example by creating a > new object and naming it ball, Python will be free to release the > memory used by the object formerly named ball (assuming no other names > currently refer to that object). If the object is visible when you > re-use the name ball, the original object will not be deleted from > computer memory, and it will remain visible in the window. > After you make an object named ball invisible, you can delete it > immediately with del ball. > Oh, yes, that's from the manual. Nevertheless, I cannot make it work (see > below). > Poul Riis > ## Demonstrates some techniques for working with "faces", and > ## shows how to build a height field (a common feature request) > ## with it. > ## David Scherer July 2001 > ## Revised January 2010 by Bruce Sherwood to use faces.smooth() function > ## introduced with VPython 5.2 > ## Revised March 2010 by Bruce Sherwood to use faces.make_normals() and > ## faces.make_twosided() functions introduced with VPython 5.3 > from visual import * > from time import * > class Model: > def __init__(self): > self.frame = frame() > self.model = faces(frame=self.frame, color=color.cyan) > self.vertices = [] > def FacetedTriangle(self, v1, v2, v3, color=color.white): > """Add a triangle to the model""" > for v in (v1,v2,v3): > self.vertices.append(v) > def FacetedPolygon(self, *v): > """Appends a planar polygon of any number of vertices to the model""" > for t in range(len(v)-2): > self.FacetedTriangle( v[0], v[t+1], v[t+2] ) > def DrawNormals(self, scale): > pos = self.model.pos > normal = self.model.normal > for i in range(len(pos)): > arrow(pos=pos[i], axis=normal[i]*scale) > class Mesh (Model): > def __init__(self, xvalues, yvalues, zvalues): > Model.__init__(self) > points = zeros( xvalues.shape + (3,), float ) > points[...,0] = xvalues > points[...,1] = yvalues > points[...,2] = zvalues > for i in range(zvalues.shape[0]-1): > for j in range(zvalues.shape[1]-1): > self.FacetedPolygon( points[i,j], points[i,j+1], > points[i+1,j+1], points[i+1,j] ) > > self.model.pos = self.vertices > self.model.make_normals() > self.model.smooth() > self.model.make_twosided() > ## Graph a function of two variables (a height field) > x = arange(-1,1,2./20) > y = arange(-1,1,2./20) > z = zeros( (len(x),len(y)), float ) > x,y = x[:,None]+z, y+z > surface=Mesh( x, (sin(x*pi)+sin(y*pi))*0.2, y ) > sleep(1) > surface.visible=False > del surface > surface=Mesh( x, (sin(x*pi)+sin(2*y*pi))*0.2, y ) > > ------------------------------------------------------------------------------ > All the data continuously generated in your IT infrastructure contains a > definitive record of customers, application performance, security > threats, fraudulent activity and more. Splunk takes this data and makes > sense of it. Business sense. IT sense. Common sense. > http://p.sf.net/sfu/splunk-d2d-oct > _______________________________________________ > Visualpython-users mailing list > Vis...@li... > https://lists.sourceforge.net/lists/listinfo/visualpython-users > > |
From: Poul R. <Pou...@sk...> - 2011-10-13 06:24:50
|
Bru...@nc... writes: >To hide a Visual object just make it invisible: ball.visible = False. >This does not delete the object from computer memory, and you can make >it visible again later. > >If however you later re-use the name ball, for example by creating a >new object and naming it ball, Python will be free to release the >memory used by the object formerly named ball (assuming no other names >currently refer to that object). If the object is visible when you >re-use the name ball, the original object will not be deleted from >computer memory, and it will remain visible in the window. > >After you make an object named ball invisible, you can delete it >immediately with del ball. Oh, yes, that's from the manual. Nevertheless, I cannot make it work (see below). Poul Riis ## Demonstrates some techniques for working with "faces", and ## shows how to build a height field (a common feature request) ## with it. ## David Scherer July 2001 ## Revised January 2010 by Bruce Sherwood to use faces.smooth() function ## introduced with VPython 5.2 ## Revised March 2010 by Bruce Sherwood to use faces.make_normals() and ## faces.make_twosided() functions introduced with VPython 5.3 from visual import * from time import * class Model: def __init__(self): self.frame = frame() self.model = faces(frame=self.frame, color=color.cyan) self.vertices = [] def FacetedTriangle(self, v1, v2, v3, color=color.white): """Add a triangle to the model""" for v in (v1,v2,v3): self.vertices.append(v) def FacetedPolygon(self, *v): """Appends a planar polygon of any number of vertices to the model""" for t in range(len(v)-2): self.FacetedTriangle( v[0], v[t+1], v[t+2] ) def DrawNormals(self, scale): pos = self.model.pos normal = self.model.normal for i in range(len(pos)): arrow(pos=pos[i], axis=normal[i]*scale) class Mesh (Model): def __init__(self, xvalues, yvalues, zvalues): Model.__init__(self) points = zeros( xvalues.shape + (3,), float ) points[...,0] = xvalues points[...,1] = yvalues points[...,2] = zvalues for i in range(zvalues.shape[0]-1): for j in range(zvalues.shape[1]-1): self.FacetedPolygon( points[i,j], points[i,j+1], points[i+1,j+1], points[i+1,j] ) self.model.pos = self.vertices self.model.make_normals() self.model.smooth() self.model.make_twosided() ## Graph a function of two variables (a height field) x = arange(-1,1,2./20) y = arange(-1,1,2./20) z = zeros( (len(x),len(y)), float ) x,y = x[:,None]+z, y+z surface=Mesh( x, (sin(x*pi)+sin(y*pi))*0.2, y ) sleep(1) surface.visible=False del surface surface=Mesh( x, (sin(x*pi)+sin(2*y*pi))*0.2, y ) |
From: Bruce S. <Bru...@nc...> - 2011-10-12 21:28:11
|
>From the documentation section "Delete an object": To hide a Visual object just make it invisible: ball.visible = False. This does not delete the object from computer memory, and you can make it visible again later. If however you later re-use the name ball, for example by creating a new object and naming it ball, Python will be free to release the memory used by the object formerly named ball (assuming no other names currently refer to that object). If the object is visible when you re-use the name ball, the original object will not be deleted from computer memory, and it will remain visible in the window. After you make an object named ball invisible, you can delete it immediately with del ball. On Wed, Oct 12, 2011 at 2:29 PM, Poul Riis <Pou...@sk...> wrote: > > I have slightly modified the faces_heightfield example in order to add > another surface (see below). > That works fine but how can I get rid of the old surface (not just make it > invisible)? > My long-term-purpose is to make an animation (the zvalues depending on > time). > > Poul Riis |
From: Poul R. <Pou...@sk...> - 2011-10-12 20:29:46
|
I have slightly modified the faces_heightfield example in order to add another surface (see below). That works fine but how can I get rid of the old surface (not just make it invisible)? My long-term-purpose is to make an animation (the zvalues depending on time). Poul Riis ## Demonstrates some techniques for working with "faces", and ## shows how to build a height field (a common feature request) ## with it. ## David Scherer July 2001 ## Revised January 2010 by Bruce Sherwood to use faces.smooth() function ## introduced with VPython 5.2 ## Revised March 2010 by Bruce Sherwood to use faces.make_normals() and ## faces.make_twosided() functions introduced with VPython 5.3 from visual import * from time import * class Model: def __init__(self): self.frame = frame() self.model = faces(frame=self.frame, color=color.cyan) self.vertices = [] def FacetedTriangle(self, v1, v2, v3, color=color.white): """Add a triangle to the model""" for v in (v1,v2,v3): self.vertices.append(v) def FacetedPolygon(self, *v): """Appends a planar polygon of any number of vertices to the model""" for t in range(len(v)-2): self.FacetedTriangle( v[0], v[t+1], v[t+2] ) def DrawNormals(self, scale): pos = self.model.pos normal = self.model.normal for i in range(len(pos)): arrow(pos=pos[i], axis=normal[i]*scale) class Mesh (Model): def __init__(self, xvalues, yvalues, zvalues): Model.__init__(self) points = zeros( xvalues.shape + (3,), float ) points[...,0] = xvalues points[...,1] = yvalues points[...,2] = zvalues for i in range(zvalues.shape[0]-1): for j in range(zvalues.shape[1]-1): self.FacetedPolygon( points[i,j], points[i,j+1], points[i+1,j+1], points[i+1,j] ) self.model.pos = self.vertices self.model.make_normals() self.model.smooth() self.model.make_twosided() ## Graph a function of two variables (a height field) x = arange(-1,1,2./20) y = arange(-1,1,2./20) z = zeros( (len(x),len(y)), float ) x,y = x[:,None]+z, y+z Mesh( x, (sin(x*pi)+sin(y*pi))*0.2, y ) sleep(1) Mesh( x, (sin(x*pi)+sin(2*y*pi))*0.2, y ) |
From: Aaron M. <mav...@gm...> - 2011-10-06 21:05:55
|
On Thu, Oct 6, 2011 at 2:57 PM, Bruce Sherwood <Bru...@nc...> wrote: > Thanks for the report. I don't immediately know why there is this difference. Related to the new handling of Unicode encoding in Python 3 perhaps? http://docs.python.org/release/3.0.1/whatsnew/3.0.html#text-vs-data-instead-of-unicode-vs-8-bit -- Aaron Mavrinac www.mavrinac.com |
From: Bruce S. <Bru...@nc...> - 2011-10-06 18:58:04
|
Thanks for the report. I don't immediately know why there is this difference. Bruce Sherwood On Thu, Oct 6, 2011 at 11:54 AM, Poul Riis <Pou...@sk...> wrote: > After upgrading to python 3.1 I cannot put Danish characters in display > titles in the same manner as before when I used \346\370\345\306\330\305 as > æøåÆØÅ (not sure how the last 6 characters are displayed on your screen > unless it has been set up to display Danish characters...). > The print commands in the example below work but the title is far from what > I hope. > Poul Riis > > from visual import * > print("\346\370\345") #æøå > print("\306\330\305") #ÆØÅ > print(chr(230)+chr(248)+chr(229))#æøå > print(chr(198)+chr(216)+chr(197))#ÆØÅ > field=display(title="\346\370\345"+"\306\330\305" > +chr(230)+chr(248)+chr(229)+chr(198)+chr(216)+chr(197), > width=900,height=900,x=500,y=0,forward=(-5,-1,-0.5),up=(0,0,1), > center=(0,0,0),background=(1,1,1),fullscreen=0,ambient=0.8) > xyplane=box(pos=(1,1,-0.05),axis=(0,0,1), length=0.1, height=2, > width=2,color=color.green,material=materials.wood,opacity=0.2) > xzplane=box(pos=(1,-0.05,1),axis=(0,1,0), length=0.1, height=2, > width=2,color=color.blue,material=materials.marble,opacity=0.2) > yzplane=box(pos=(-0.05,1,1),axis=(1,0,0), length=0.1, height=2, > width=2,color=color.red,material=materials.blazed,opacity=0.2) > > > > ------------------------------------------------------------------------------ > All the data continuously generated in your IT infrastructure contains a > definitive record of customers, application performance, security > threats, fraudulent activity and more. Splunk takes this data and makes > sense of it. Business sense. IT sense. Common sense. > http://p.sf.net/sfu/splunk-d2dcopy1 > _______________________________________________ > Visualpython-users mailing list > Vis...@li... > https://lists.sourceforge.net/lists/listinfo/visualpython-users > > |
From: Poul R. <Pou...@sk...> - 2011-10-06 18:10:55
|
After upgrading to python 3.1 I cannot put Danish characters in display titles in the same manner as before when I used \346\370\345\306\330\305 as æøåÆØÅ (not sure how the last 6 characters are displayed on your screen unless it has been set up to display Danish characters...). The print commands in the example below work but the title is far from what I hope. Poul Riis from visual import * print("\346\370\345") #æøå print("\306\330\305") #ÆØÅ print(chr(230)+chr(248)+chr(229))#æøå print(chr(198)+chr(216)+chr(197))#ÆØÅ field=display(title="\346\370\345"+"\306\330\305" +chr(230)+chr(248)+chr(229)+chr(198)+chr(216)+chr(197), width=900,height=900,x=500,y=0,forward=(-5,-1,-0.5),up=(0,0,1), center=(0,0,0),background=(1,1,1),fullscreen=0,ambient=0.8) xyplane=box(pos=(1,1,-0.05),axis=(0,0,1), length=0.1, height=2, width=2,color=color.green,material=materials.wood,opacity=0.2) xzplane=box(pos=(1,-0.05,1),axis=(0,1,0), length=0.1, height=2, width=2,color=color.blue,material=materials.marble,opacity=0.2) yzplane=box(pos=(-0.05,1,1),axis=(1,0,0), length=0.1, height=2, width=2,color=color.red,material=materials.blazed,opacity=0.2) |
From: Kevin K. <ka...@so...> - 2011-10-02 23:11:56
|
David, graphtest.py works fine on my Mac OS 10.6.8 system, running Python 2.7.2. print visual.version produces ('5.71', 'release') Exactly what system are you running on, with what version of Python and with what version of visual? If the Python or the visual are not the latest versions, try upgrading the old code first. Kevin Karplus |
From: David W. <dav...@mu...> - 2011-10-02 22:35:34
|
Hello all, I'm having trouble seeing plots in VPython. When I run graphtest.py I can only see the red histogram and the yellow dots, but not the cyan curve. This behavior also shows up when I create a plot of my own, except I can't see any curves at all. The graph window appears and the axes scale as though data is being plotted, but it is invisible. Any help/suggestions/guidance would be appreciated. David Wiggins |
From: Bruce S. <Bru...@nc...> - 2011-09-26 04:39:25
|
In May 2008 I posted a question about how to to deal with threading issues in Visual using the Cocoa framework. You can see the thread here: http://lists.apple.com/archives/cocoa-dev/2008/May/msg00230.html Note the response that says that similar serious problems had been encountered with Java. Bruce Sherwood On Sun, Sep 25, 2011 at 3:43 PM, Kevin Karplus <ka...@so...> wrote: > > Yes, the Mac version of PyGUI does use Cocoa and requires PyObjC to > interface to Cocoa. > There is no mention of threads in the Cocoa part of the code. > > What exactly about thread priorities in Cocoa made Vpython impossible there? > > |
From: Kevin K. <ka...@so...> - 2011-09-25 21:43:14
|
Yes, the Mac version of PyGUI does use Cocoa and requires PyObjC to interface to Cocoa. There is no mention of threads in the Cocoa part of the code. What exactly about thread priorities in Cocoa made Vpython impossible there? |