def step_assert_material_color_of_s_equals_color(context, red, green, blue): assert_tuple(context.s.material.color, color(red, green, blue))
def step_impl(context, x, y, z): actual = multiply_tuple(context.transform, context.p) expected = point(x, y, z) assert_tuple(actual, expected)
def step_impl(context, x, y, z): actual = multiply_tuple(context.full_quarter, context.p) expected = point(x, y, z) assert_tuple(actual, expected)
def step_assert_light_corner_equals_corner(context): assert_tuple(context.light.corner, context.corner)
def step_assert_normal_equals_vector(context): assert_tuple(context.normal, vector(1, -sqrt(2), 1))
def step_assert_light_intensity_equals_c(context): assert_tuple(context.light.intensity, context.c)
def step_assert_light_intensity_equals_color(context, red, green, blue): assert_tuple(context.light.intensity, color(red, green, blue))
def step_assert_p2_of_triangle(context): assert_tuple(context.t.p2, context.p2)
def step_assert_p3_of_triangle(context): assert_tuple(context.t.p3, context.p3)
def step_assert_p_equals_point(context, x, y, z): assert_tuple(context.p, point(x, y, z))
def step_assert_p1_of_triangle(context): assert_tuple(context.t.p1, context.p1)
def step_assert_n_equals_normalized_n(context): assert_tuple(context.n, normalize(context.n))
def step_assert_saved_ray_direction_equals_vector(context, x, y, z): assert_tuple(context.s.saved_ray.direction, vector(x, y, z))
def step_assert_saved_ray_origin_equals_point(context, x, y, z): assert_tuple(context.s.saved_ray.origin, point(x, y, z))
def step_impl(context): assert_tuple(hadamard(context.c1, context.c2), color(0.9, 0.2, 0.04))
def step_assert_e1_of_triangle(context): assert_tuple(context.t.e1, vector(-1, -1, 0))
def step_assert_light_position_equals_p(context): assert_tuple(context.light.position, context.p)
def step_assert_e2_of_triangle(context): assert_tuple(context.t.e2, vector(1, -1, 0))
def step_assert_light_positon_equals_point(context, x, y, z): assert_tuple(context.light.position, point(x, y, z))
def step_assert_normal_of_triangle(context): assert_tuple(context.t.normal, vector(0, 0, -1))
def step_assert_light_corner_equals_point(context, x, y, z): assert_tuple(context.light.corner, point(x, y, z))
def step_assert_var_equals_normal_of_triangle(context, var_name): var = getattr(context, var_name, None) assert_tuple(var, context.t.normal)
def step_assert_light_uvec_equals_vector(context, x, y, z): assert_tuple(context.light.uvec, vector(x, y, z))
def step_assert_material_color_of_object_at_index(context, index, red, green, blue): assert_tuple(context.w.objects[index].material.color, color(red, green, blue))
def step_assert_attribute_of_smooth_triangle(context, var_name): actual = getattr(context.tri, var_name, None) expected = getattr(context, var_name, None) assert_tuple(actual, expected)
def step_assert_c_equals_color(context, red, green, blue): assert_tuple(context.c, color(red, green, blue))
def step_impl(context): actual = multiply_tuple(context.half_quarter, context.p) expected = point(-sqrt(2) / 2, sqrt(2) / 2, 0) assert_tuple(actual, expected)
def step_impl(context): actual = subtract(context.c1, context.c2) assert_tuple(actual, color(0.2, 0.5, 0.5))
def step_assert_n3_equals_vector(context, x, y, z): assert_tuple(context.n3, vector(x, y, z))
def step_assert_n_equals_certain_vector(context): xyz = sqrt(3) / 3 assert_tuple(context.n, vector(xyz, xyz, xyz))