From: Poul R. <Pou...@sk...> - 2012-10-13 10:53:29
|
Bru...@nc... writes: >so I assume you are asking whether there is a way to permit autoscaling >but force the scale factors to be equal. Yes, that's what I want. I hope that someone can give me a hint on how to do it. In the minimal example below I want the spiral to keep its shape fixed, still autoscaling when points fall outside the actual window. BTW, running the example results in the following error message on my computer: VPython WARNING: errors in shader program: It does not seem to be fatal but I would like to know what the reason is and how to get rid of it. from visual import * import visual.graph as visualgraph from time import * spiralgraph=visualgraph.gdisplay(title='Spiral', ytitle='x', xtitle='y', x=0, y=0, width=800, height=800,foreground=visualgraph.color.black, background=visualgraph.color.white) spiralplot = visualgraph.gdots(color=visualgraph.crayola.blue,display=spiralgraph) for i in range(0,3600): t=pi*i/360 spiralplot.plot(pos=(t*cos(t),t*sin(t))) sleep(0.001) |
From: Poul R. <Pou...@sk...> - 2012-10-14 18:32:35
|
Even worse now: Running the program below now results in the following error message: Traceback (most recent call last): File "C:\pr\python\spiral.py", line 11 spiralplot = visualgraph.curve(color=visualgraph.crayola.magenta,display=spiralgraph) File "C:\Python32\lib\site-packages\vis\primitives.py", line 82, in __init__ if not _other: self.init_defaults(keywords) File "C:\Python32\lib\site-packages\vis\primitives.py", line 175, in init_defaults self.material = self.display.material AttributeError: 'gdisplay' object has no attribute 'material' import visual.graph as visualgraph from time import * from math import * spiralgraph=visualgraph.gdisplay(title='Spiral', ytitle='x', xtitle='y', x=0, y=0, width=800, height=800, foreground=visualgraph.color.black, background=visualgraph.color.white) spiralplot = visualgraph.curve(color=visualgraph.crayola.magenta,display=spiralgraph) spiralplot.plot(pos=(-15,-15)) spiralplot.plot(pos=(15,-15)) spiralplot.plot(pos=(15,15)) spiralplot.plot(pos=(-15,15)) spiralplot.plot(pos=(-15,-15)) for i in range(0,3600): t=pi*i/360 x=t*cos(t) y=t*sin(t) spiralplot.plot(pos=(x,y)) sleep(0.001) Poul Riis |
From: Bruce S. <Bru...@nc...> - 2012-10-14 20:12:17
|
What did you change? That is, what do you mean by "now"? Presumably you didn't get such a very strange message before making some change. Maybe you need to reinstall visual? Bruce Sherwood On Sun, Oct 14, 2012 at 12:32 PM, Poul Riis <Pou...@sk...> wrote: > Even worse now: > > Running the program below now results in the following error message: > > Traceback (most recent call last): > File "C:\pr\python\spiral.py", line 11 > spiralplot = > visualgraph.curve(color=visualgraph.crayola.magenta,display=spiralgraph) > File "C:\Python32\lib\site-packages\vis\primitives.py", line 82, in > __init__ > if not _other: self.init_defaults(keywords) > File "C:\Python32\lib\site-packages\vis\primitives.py", line 175, in > init_defaults > self.material = self.display.material > AttributeError: 'gdisplay' object has no attribute 'material' > > > > > > import visual.graph as visualgraph > from time import * > from math import * > > spiralgraph=visualgraph.gdisplay(title='Spiral', ytitle='x', xtitle='y', > x=0, y=0, > width=800, height=800, > foreground=visualgraph.color.black, > background=visualgraph.color.white) > spiralplot = > visualgraph.curve(color=visualgraph.crayola.magenta,display=spiralgraph) > spiralplot.plot(pos=(-15,-15)) > spiralplot.plot(pos=(15,-15)) > spiralplot.plot(pos=(15,15)) > spiralplot.plot(pos=(-15,15)) > spiralplot.plot(pos=(-15,-15)) > for i in range(0,3600): > t=pi*i/360 > x=t*cos(t) > y=t*sin(t) > spiralplot.plot(pos=(x,y)) > sleep(0.001) > > > > > Poul Riis |
From: Poul R. <Pou...@sk...> - 2012-10-14 20:14:50
|
Oh, yes, I'm sorry, I missed a 'g' in gcurve! Poul Riis from time import * from math import * import visual.graph as visualgraph spiralgraph=visualgraph.gdisplay(title='Spiral', ytitle='x', xtitle='y', x=0, y=0, width=800, height=800, foreground=visualgraph.color.black, background=visualgraph.color.white) spiralplot = visualgraph.curve(color=visualgraph.color.red,display=spiralgraph) spiralplot.plot(pos=(-15,-15)) spiralplot.plot(pos=(15,-15)) spiralplot.plot(pos=(15,15)) spiralplot.plot(pos=(-15,15)) spiralplot.plot(pos=(-15,-15)) for i in range(0,3600): t=pi*i/360 x=t*cos(t) y=t*sin(t) spiralplot.plot(pos=(x,y)) sleep(0.001) |