예제 #1
0
def test_matrix_methods_again():

    m = Matrix(
        [0, 1, 0, 0],
        [1, 0, 0, 0],
        [0, 0, 1, 0],
        [3, 3, 3, 1],
    )

    determinant = -1

    adjoint = Matrix(
        [0, -1, 0, 0],
        [-1, 0, 0, 0],
        [0, 0, -1, 0],
        [3, 3, 3, -1],
    )

    inverse = Matrix(
        [0, 1, 0, 0],
        [1, 0, 0, 0],
        [0, 0, 1, 0],
        [-3, -3, -3, 1],
    )

    assert m.determinant() == determinant
    assert m.adjoint() == adjoint
    assert m.inverse() == inverse
예제 #2
0
def test_matrix_inversion():

    m = Matrix(
        [0, 0, 1, 0],
        [1, 0, 0, 0],
        [0, 1, 0, 0],
        [3, 3, 3, 1],
    )

    inverse = Matrix(
        [0, 1, 0, 0],
        [0, 0, 1, 0],
        [1, 0, 0, 0],
        [-3, -3, -3, 1],
    )

    assert m.inverse() == inverse
예제 #3
0
 def __init__(self):
     self.points = []
     self.triangles = []
     self.quads = []
     self.polygons = []
     self.point_color = [0, 0, 1]
     self.face_color = [0, 1, 0]
     self.matrix = Matrix.identity()
예제 #4
0
def test_matrix_inversion():

    m = Matrix(
        [0, 0, 1, 0],
        [1, 0, 0, 0],
        [0, 1, 0, 0],
        [3, 3, 3, 1],
    )

    inverse = Matrix(
        [0, 1, 0, 0],
        [0, 0, 1, 0],
        [1, 0, 0, 0],
        [-3, -3, -3, 1],
    )

    assert m.inverse() == inverse
예제 #5
0
 def __init__(self):
     self.points = []
     self.triangles = []
     self.quads = []
     self.polygons = []
     self.point_color = [0, 0, 1]
     self.face_color = [0, 1, 0]
     self.matrix = Matrix.identity()
예제 #6
0
def test_matrix_methods_again():

    m = Matrix(
        [0, 1, 0, 0],
        [1, 0, 0, 0],
        [0, 0, 1, 0],
        [3, 3, 3, 1],
    )

    determinant = -1

    adjoint = Matrix(
        [0, -1, 0, 0],
        [-1, 0, 0, 0],
        [0, 0, -1, 0],
        [3, 3, 3, -1],
    )

    inverse = Matrix(
        [0, 1, 0, 0],
        [1, 0, 0, 0],
        [0, 0, 1, 0],
        [-3, -3, -3, 1],
    )

    assert m.determinant() == determinant
    assert m.adjoint() == adjoint
    assert m.inverse() == inverse