def test_schlick_perpendicular():
    s = GlassSphere()
    r = Ray(Point(0, 0, 0), Vector(0, 1, 0))
    xs = Intersections(Intersection(-1, s), Intersection(1, s))
    comps = xs[1].prepare_computation(r, xs)
    reflectance = comps.schlick()
    assert equal(reflectance, 0.04)
def test_schlick_small_angle():
    s = GlassSphere()
    r = Ray(Point(0, 0.99, -2), Vector(0, 0, 1))
    xs = Intersections(Intersection(1.8589, s))
    comps = xs[0].prepare_computation(r, xs)
    reflectance = comps.schlick()
    assert equal(reflectance, 0.48873)
Exemple #3
0
def test_cone_parallel_ray():
    s = Cone()
    direction = Vector(0, 1, 1).normalize()
    r = Ray(Point(0, 0, -1), direction)
    xs = s.local_intersect(r)
    assert len(xs) == 1
    assert equal(xs[0].t, 0.35355)
def test_ray_hit_3():
    t0, t1 = ray_hit_helper(Point(0.5, 0, -5), Vector(0.1, 1, 1))
    assert equal(6.80798, t0)
    assert equal(7.08872, t1)
Exemple #5
0
def test_cone_ray_3():
    t0, t1 = cone_ray_helper(Point(1, 1, -5), Vector(-0.5, -1, 1))
    assert equal(t0, 4.55006)
    assert equal(t1, 49.44994)
Exemple #6
0
def test_cone_ray_2():
    t0, t1 = cone_ray_helper(Point(0, 0, -5), Vector(1, 1, 1))
    assert equal(t0, 8.66025)
    assert equal(t1, 8.66025)
Exemple #7
0
def test_v_pixel_size():
    c = Camera(125, 200, math.pi / 2)
    assert equal(c.pixel_size, 0.01)
Exemple #8
0
def test_h_pixel_size():
    c = Camera(200, 125, math.pi / 2)
    assert equal(c.pixel_size, 0.01)