示例#1
0
def _check_t_value(self, name, value):
    test_value = float(value)
    print("\nExpected:")
    print(test_value)
    print("\nGot:")
    print(getattr(world, name).t)
    assert equals(getattr(world, name).t, test_value)
示例#2
0
def _check_determinant(self, name, determinant):
    print("\ndeterminant(" + name + ")")
    print("-----")
    print("\nExpected:")
    print(float(determinant))
    print("\nGot:")
    print(getattr(world, name).determinant())
    assert equals(getattr(world, name).determinant(), float(determinant))
示例#3
0
def _check_matrix_element(self, name, row, col, value):
    print("\n" + name + '[' + str(row) + '][' + str(col) + ']')
    print("-----")
    print("\nExpected:")
    print(value)
    print("\nGot:")
    print(getattr(world, name)[int(row)][int(col)])
    assert equals(getattr(world, name)[int(row)][int(col)], float(value))
示例#4
0
def _check_pixel_size(self, name, size):
    test_size = float(size)
    actual_size = getattr(world, name).pixel_size
    print("Expected:")
    print(test_size)
    print("\nGot:")
    print(actual_size)
    assert equals(actual_size, test_size)
示例#5
0
def _check_fov(self, name, attr, value):
    test_fov = float(value)
    fov = getattr(getattr(world, name), attr)
    print("\nExpected:")
    print(test_fov)
    print("\nGot:")
    print(fov)
    assert equals(fov, test_fov)
示例#6
0
def _check_intersections_t_value(self, name, index, value):
    test_value = float(value)
    test_index = int(index)
    print("\nExpected:")
    print(test_value)
    print("\nGot:")
    print(getattr(world, name)[test_index].t)
    assert equals(getattr(world, name)[test_index].t, test_value)
示例#7
0
 def __eq__(self, other):
     if self.rows == other.rows and self.cols == other.cols:
         for r in range(0, self.rows):
             for c in range(0, self.cols):
                 if not equals(self[r][c], other[r][c]):
                     return False
         return True
     else:
         return False
示例#8
0
def _check_cofactor(self, name, row, col, cofactor):
    print("\ncofactor(" + name + ", " + row + ", " + col + ")")
    print("-----")
    print("\nExpected:")
    print(float(cofactor))
    print("\nGot:")
    print(getattr(world, name).cofactor(int(row), int(col)))
    assert equals(
        getattr(world, name).cofactor(int(row), int(col)), float(cofactor))
示例#9
0
 def local_intersects(self, ray):
     # Incoming ray is now in object space already
     # If the ray is parallel to the plane (y = 0), there
     # is no intersection
     if maths.equals(ray.direction.y, 0):
         return Intersections()
     else:
         # Otherwise, the ray is intersecting from above
         # or below
         t = -ray.origin.y / ray.direction.y
         return Intersections(Intersection(t, self))
示例#10
0
def _index_equals_value(self, name, index, value):
    print("\nExpected:")
    print(float(value))
    print("\nGot:")
    print(getattr(world, name)[int(index)])
    assert equals(getattr(world, name)[int(index)], float(value))
示例#11
0
def _canvas_member_equals(self, name, member, value):
    assert equals(getattr(getattr(world, name), member), int(value))
示例#12
0
 def isInvertible(self):
     return not equals(self.determinant(), 0)
示例#13
0
def _check_minor(self, name, row, col, minor):
    print("\nExpected:")
    print(float(minor))
    print("\nGot:")
    print(getattr(world, name).minor(int(row), int(col)))
    assert equals(getattr(world, name).minor(int(row), int(col)), float(minor))
示例#14
0
 def __eq__(self, other):
     if (equals(self.x, other.x) and equals(self.y, other.y)
             and equals(self.z, other.z) and equals(self.z, other.z)):
         return True
     else:
         return False