def offset_xy(self, origin_x, origin_y, caller=None): """ Shifts this event to be in the coordinate frame whose origin, specified in the event's coordinate frame, is (origin_x, origin_y). Basically, a component calls event.offset_xy(\*self.position) to shift the event into its own coordinate frame. """ self.push_transform(affine.affine_from_translation(-origin_x, -origin_y)) if caller is not None: self.dispatch_history.append(caller) return
def offset_xy(self, origin_x, origin_y, caller=None): r""" Shifts this event to be in the coordinate frame whose origin, specified in the event's coordinate frame, is (origin_x, origin_y). Basically, a component calls event.offset_xy(\*self.position) to shift the event into its own coordinate frame. """ self.push_transform( affine.affine_from_translation(-origin_x, -origin_y)) if caller is not None: self.dispatch_history.append(caller) return
def get_event_transform(self, event=None, suffix=""): return affine.affine_from_translation(-self.x, -self.y)
def test_from_translation(self): transform = affine.affine_from_translation(5., 6.) pt1 = array([1., 1., 1.]) actual = dot(pt1, transform) desired = pt1 + array((5., 6., 0.)) assert (alltrue(actual == desired))
def test_from_translation(self): transform = affine.affine_from_translation(5.,6.) pt1 = array([1.,1.,1.]) actual = dot(pt1,transform) desired = pt1+array((5.,6.,0.)) assert(alltrue( actual == desired ))
def test_from_translation(self): transform = affine.affine_from_translation(5.0, 6.0) pt1 = array([1.0, 1.0, 1.0]) actual = dot(pt1, transform) desired = pt1 + array((5.0, 6.0, 0.0)) assert alltrue(actual == desired)