I started using VTK the other day, and now I’m mainly working on the code for the tutorial.
I would like to use VTK to rotate an object by specifying the rotation angle from the GUI, or to read the sensor value and rotate the object as in the real world.
However, the vtkRenderWindowInteractor makes other operations impossible, and it was also impossible to change the PolyData value from another thread.
For example, in the last part of this example, I tried to change the following without using the vtkRenderWindowInteractor.
# render the image renWin.Render() renderer.ResetCamera() renderer.GetActiveCamera().Elevation(-30) renderer.GetActiveCamera().Roll(-20) renderer.ResetCameraClippingRange() renWin.Render() # --- change from here --- # iren.Start() # delete # add z = 0 While True: plane.SetCenter(0, 0, z) z+=0.01 renWin.Render()
I know this is obviously wrong (in fact, this code didn’t work), but I didn’t know what other code I could use to implement the functionality.
Is there any other way to implement this kind of operation?
Also, I thought about using animation, but I don’t think it would be possible to implement the movement I have in mind, which is to change the direction of rotation according to the sensor value.
Any suggestion is appreciated!