Ejemplo n.º 1
0
    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
Ejemplo n.º 2
0
    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
Ejemplo n.º 3
0
 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))
Ejemplo n.º 5
0
 def get_event_transform(self, event=None, suffix=""):
     return affine.affine_from_translation(-self.x, -self.y)
Ejemplo n.º 6
0
 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 ))
Ejemplo n.º 7
0
 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)