def motion(x1, y1): global x0, y0, rotation, scale if rotating: p0 = screen2space(x0, y0) p1 = screen2space(x1, y1) rotation = q.product(rotation, q.arcball(*p0), q.arcball(*p1)) if scaling: scale *= exp(((x1 - x0) - (y1 - y0)) * .01) x0, y0 = x1, y1 glutPostRedisplay()
def arcball(_, p0, p1): ''' set the rotation only according to the arcball''' _.rotation = _q.product(_.rotation, _q.arcball(*p0), _q.arcball(*p1)) _.matrix = _q.matrix(_.rotation) '''