Exemple #1
0
def test_intersect_ray_and_sphere_with_different_origin():
    assert (_intersect_ray_with_sphere(
        Ray(Point((0, 0, 0)), Vector((1, 1, 1))), Sphere(Point((3, 3, 3)), 1))
            == (Point([2.42, 2.42, 2.42]), Point([3.58, 3.58, 3.58]))) is True
Exemple #2
0
def test_intersect_ray_and_sphere_with_different_origin_and_opposite_direction(
):
    assert (_intersect_ray_with_sphere(
        Ray(Point((0, 0, 0)), Vector(
            (-1, -1, -1))), Sphere(Point(
                (3, 3, 3)), 1)) == "No Intersecction") is True
Exemple #3
0
def test_intersect_ray_and_sphere_with_same_origin():
    assert (_intersect_ray_with_sphere(
        Ray(Point((0, 0, 0)), Vector((1, 1, 1))), Sphere(Point(
            (0, 0, 0)), 2)) == Point([1.15, 1.15, 1.15])) is True