Exemple #1
0
    def test_invert_rotation(self):
        assert rotate(-45) == matrix_inverse(rotate(45))
        assert rotate(90) == matrix_inverse(rotate(-90))

        assert identity() == matrix_multiply(rotate(45), rotate(-45))
        assert identity() == matrix_multiply(rotate(-45), rotate(45))

        assert identity() == matrix_multiply(rotate(90), rotate(-90))
        assert identity() == matrix_multiply(rotate(-90), rotate(90))
Exemple #2
0
    def test_invert_identity(self):
        I = identity()

        assert I == matrix_inverse(I)
Exemple #3
0
 def test_invert_translate(self):
     assert translate(-3, -5) == matrix_inverse(translate(3, 5))
     assert translate(-2, 1) == matrix_inverse(translate(2, -1))
Exemple #4
0
    def test_invert_scale(self):
        assert scale(2, 4) == matrix_inverse(scale(0.5, 0.25))
        assert scale(0.1, 8) == matrix_inverse(scale(10, 0.125))

        assert identity() == matrix_multiply(scale(2, 4), scale(0.5, 0.25))
        assert identity() == matrix_multiply(scale(0.1, 8), scale(10, 0.125))
Exemple #5
0
    def test_invert_identity(self):
        ident = identity()

        assert ident == matrix_inverse(ident)