コード例 #1
0
ファイル: test_primitives.py プロジェクト: qTipTip/RayTracer
def test_sphere_normal_at_scaled():
    s = Sphere()
    s.set_transform(scaling(1, 0.5, 1))
    n = s.normal_at(Point(0, sqrt(2) / 2, -sqrt(2) / 2))
    assert n == Vector(0, 0.9701425001453319, -0.24253562503633297)
コード例 #2
0
ファイル: test_primitives.py プロジェクト: qTipTip/RayTracer
def test_sphere_normal_at_translate():
    s = Sphere()
    s.set_transform(translation(0, 1, 0))
    n = s.normal_at(Point(0, 1.70711, -0.70711))
    assert n == Vector(0, 0.7071067811865475, -0.7071067811865476)
コード例 #3
0
ファイル: test_primitives.py プロジェクト: qTipTip/RayTracer
def test_sphere_normal_normalized():
    s = Sphere()
    n = s.normal_at(Point(sqrt(3) / 3, sqrt(3) / 3, sqrt(3) / 3))

    assert n == n.normalize()
コード例 #4
0
ファイル: test_primitives.py プロジェクト: qTipTip/RayTracer
def test_sphere_normal_at_arbitrary():
    s = Sphere()
    n = s.normal_at(Point(sqrt(3) / 3, sqrt(3) / 3, sqrt(3) / 3))

    assert n == Vector(sqrt(3) / 3, sqrt(3) / 3, sqrt(3) / 3)
コード例 #5
0
ファイル: test_primitives.py プロジェクト: qTipTip/RayTracer
def test_sphere_normal_at_z():
    s = Sphere()
    n = s.normal_at(Point(0, 0, 1))
    assert n == Vector(0, 0, 1)
コード例 #6
0
ファイル: test_primitives.py プロジェクト: qTipTip/RayTracer
def test_sphere_normal_at_x():
    s = Sphere()
    n = s.normal_at(Point(1, 0, 0))

    assert n == Vector(1, 0, 0)