def initialize_modelview(self, eye_vector=None, angle=None): super(RLVWindow, self).initialize_modelview(eye_vector=eye_vector, angle=angle) self.rotation_center = (0, 0, 0) self.move_to_center_of_viewport(self.rotation_center) if self.settings.model_view_matrix is not None: gl.glLoadMatrixd(self.settings.model_view_matrix)
def snap_back_rotation(self): rc = self.rotation_center rotation_to_undo = matrix.sqr( gltbx.util.extract_rotation_from_gl_modelview_matrix()) if self.marked_rotation is not None: rotation_to_undo *= self.marked_rotation.inverse() aa = scitbx.math.r3_rotation_axis_and_angle_from_matrix( r=rotation_to_undo.as_mat3()) u, v, w = aa.axis angle = -aa.angle(deg=True) mvm = gltbx.util.get_gl_modelview_matrix() for f in animation_stepper( time_move=self.animation_time, move_factor=self.rotation_move_factor(angle)): gl.glMatrixMode(gl.GL_MODELVIEW) gl.glLoadMatrixd(mvm) gltbx.util.rotate_object_about_eye_vector( xcenter=rc[0], ycenter=rc[1], zcenter=rc[2], xvector=u, yvector=v, zvector=w, angle=f * angle, ) self.OnRedraw()