Ejemplo n.º 1
0
    def test_translate(self):
        p = Point(30, 70)
        p.rotate(Point(0, 0), math.pi / 4)
        self.assertEqual(p.x, -28.284271247461906)
        self.assertEqual(p.y, 70.71067811865476)

        p = Point(30, 70)
        m = AffineTransformation.rotation(math.pi / 4)
        p.transform(m)
        self.assertAlmostEqual(p.x, -28.284271247461906)
        self.assertAlmostEqual(p.y, 70.71067811865476)

        p = Point(0, 10)
        m = AffineTransformation.translation(Point(5, -2))
        p.transform(m)
        self.assertEqual(p.x, 5)
        self.assertEqual(p.y, 8)
Ejemplo n.º 2
0
 def alignmentTransformation(self):
   m = AffineTransformation.translation(self.start * -1)
   m.rotate((self.end.transformed(m)).angle * -1)
   return m
Ejemplo n.º 3
0
 def alignmentTransformation(self):
     m = AffineTransformation.translation(self.start * -1)
     m.rotate((self.end.transformed(m)).angle * -1)
     return m