def test_intersect5(self): r = Ray(point(0, 0, 5), vector(0, 0, 1)) s = Sphere() i = s.intersect(r) self.assertEqual(2, len(i)) self.assertEqual(-6.0, i[0].t) self.assertEqual(-4.0, i[1].t)
def test_intersect_sphere1(self): s = Sphere() r = Ray(point(0, 0, -5), vector(0, 0, 1)) s.set_transform(xf_scale(2, 2, 2)) i = s.intersect(r) self.assertEqual(2, len(i)) self.assertEqual(i[0].t, 3.0) self.assertEqual(i[1].t, 7.0)
def test_intersect3(self): r = Ray(point(0, 2, -5), vector(0, 0, 1)) s = Sphere() i = s.intersect(r) self.assertEqual(0, len(i))