How do you use Vispy to rotate a cube in three dimensions (roll, pitch, yaw)?
There's an example for rotating a cube in two dimensions here, but I'm not sure how to extend it to rotate in the third dimension.
I think I need to modify the on_timer()
method. I tried changing it from:
def on_timer(self, event):
self.theta += .5
self.phi += .5
self.model = np.dot(rotate(self.theta, (0, 1, 0)),
rotate(self.phi, (0, 0, 1)))
self.program['u_model'] = self.model
self.update()
to:
def on_timer(self, event):
self.gamma += .5
self.theta += .5
self.phi += .5
self.model = np.dot(
rotate(self.gamma, (1, 0, 0)),
np.dot(rotate(self.theta, (0, 1, 0)),
rotate(self.phi, (0, 0, 1))),
)
self.program['u_model'] = self.model
self.update()
but that only seems to make the third dimension duplicate the second. What am I doing wrong?