Exemple #1
0
def test_reflection():
    point = [1, 1, 1]
    normal = [0, 0, 1]
    R1 = Reflection(point, normal)
    R2 = Transformation.from_matrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, -1, 2],
                                     [0, 0, 0, 1]])
    assert R1 == R2
Exemple #2
0
def test_reflection_from_frame():
    point = [1, 1, 1]
    x = [1, 0, 0]
    y = [0, 1, 0]

    f = Frame(point, x, y)
    R1 = Reflection.from_frame(f)
    R2 = Transformation.from_matrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, -1, 2],
                                     [0, 0, 0, 1]])
    assert R1 == R2
def test_from_matrix():
    t = Transformation().matrix
    assert Transformation.from_matrix(t).matrix == t