def test_construct_camera(self):
     hsize = 160
     vsize = 120
     field_of_view = pi / 2
     c = Camera(hsize, vsize, field_of_view)
     assert c.hsize == 160
     assert c.vsize == 120
     assert c.field_of_view == pi / 2
     assert c.transformation == Matrix.identity()
예제 #2
0
 def test_transpose_identity_matrix(self):
     a = Matrix.identity().transpose()
     assert a == Matrix.identity()
예제 #3
0
 def test_multiply_identity_matrix_by_tuple(self):
     a = Tuple(1, 2, 3, 4)
     assert Matrix.identity() * a == a
예제 #4
0
 def test_multiply_matrix_by_identity_matric(self):
     a = Matrix([[0, 1, 2, 4], [1, 2, 4, 8], [2, 4, 8, 16], [4, 8, 16, 32]])
     assert a * Matrix.identity() == a
 def test_default_pattern_transformation(self):
     pattern = test_pattern()
     assert pattern.transformation == Matrix.identity()
예제 #6
0
 def test_view_transformation_for_default_orientation(self):
     _from = Point(0, 0, 0)
     to = Point(0, 0, -1)
     up = Vector(0, 1, 0)
     t = view_transform(_from, to, up)
     assert t == Matrix.identity()