Exemplo n.º 1
0
def mirror(pivot: Vector, center: Vector, norm: Vector):
    base = pivot - center
    norm.normalize()
    a = copy.deepcopy(base)
    a.rotate(Triangle.get_rotate_matrix(norm, 2 / 3 * math.pi))
    a = center + a
    b = copy.deepcopy(base)
    b.rotate(Triangle.get_rotate_matrix(norm, -2 / 3 * math.pi))
    b = center + b
    return [pivot.get_point(), a.get_point(), b.get_point()]
Exemplo n.º 2
0
 def test_normalize(self):
     d = Vector(1, 2)
     d = d.normalize()
     self.assertAlmostEqual(d.length(), 1)