Hello all,
I have written an application that animates electromagnetic waves and
I have some problems with the way VPython displays the curves.
Essentially, I have three curves that are continually updated (this is
how the animation is realized). The problem is that their motion is
not synchronized. Let's say the three curves are a, b and c. Then I
have a loop in the Python code like this:
t=0
while 1:
a.pos, b.pos, c.pos = f(t), g(t), h(t)
t=t+1
Basically I want to update the three curves at the same moment so that
they simultaneously change. But when I update one curve, VPython
immediately displays the curve with the updated positions, and
sometimes this happens even before the second curve is updated. This
results in the motion of the three curves being slightly out of synch,
and this causes visible jerkiness in the motion. My understanding is
that in VPython, a separate thread watches the positions of all
objects and it immediately displays the new configuration whenever
something changes. What I would like to do is to freeze or suspend
this thread until everything is updated, something like this:
t=0
while 1:
scene.suspend()
a.pos=f(t)
b.pos=g(t)
c.pos=h(t)
scene.continue()
t=t+1
Is there a way to do this? If no, I would like to suggest this feature
for the future versions. Or, if someone knows a workaround, please
share it.
Thanks,
Andras
|