Exemplo n.º 1
0
def test_scaling_a_ray():
    # Given
    r = Ray(Point(1, 2, 3), Vector(0, 1, 0))
    m = scaling(2, 3, 4)
    # When
    r2 = r.transform(m)
    # Then
    assert r2.origin == Point(2, 6, 12)
    assert r2.direction == Vector(0, 3, 0)
Exemplo n.º 2
0
def test_translating_a_ray():
    # Given
    r = Ray(Point(1, 2, 3), Vector(0, 1, 0))
    m = translation(3, 4, 5)
    # When
    r2 = r.transform(m)
    # Then
    assert r2.origin == Point(4, 6, 8)
    assert r2.direction == Vector(0, 1, 0)