#47 Synchronizing threads

feature request
open
nobody
2
2001-02-15
2000-12-27
Bruce Sherwood
No

From Markus Gritsch <gritsch@iue.tuwien.ac.at>:

The problem without synchronization is that the visualization of a scene with much animation in it is "distorted", because during a visualization cycle some objects have their old position and some others already appear on their new location. For example I have a scene with some springs in it, each represented by a helix (curve). Because the whole spring is moving around quite fast, part of it has the old coordinates and the other part already appears at the new calculated ones.

Would it be possible to hav a function similar to visual.rate() which suspends the visualization thread and another to reactivate it? In this way it would be possible in the while loop to suspend it, do the calculations, activate it and suspend it again before doing the next cycle.

while 1:
visual.stop() # suspend the visualization thread
doMyCalculations()
visual.start() # resume the visualization thread
visual.rate(30)

Discussion

  • Bruce Sherwood
    Bruce Sherwood
    2001-02-15

    • priority: 1 --> 2
     
  • Polyergic
    Polyergic
    2012-07-28

    Not having control of redraws makes vpython unusable for me. I'm amazed that something so fundamental has gone unaddressed for more than 10 years. I would like to be able to do something like this:

    visual.autoredraw = false
    while updateScene()
    visual.redraw()

    For one easy to see example of the problem, run my code at http://pastebin.com/srsZLKWR and make it continuously advance (by clicking on a blue arrow, dragging the mouse, and then holding the button down). On my computer you can see clearly the particles update before the field arrows, and you can watch the updating of the field arrows propagate through the field.