test_matrix_invert.py 522 B

1234567891011121314151617181920
  1. import pytest
  2. from panda3d import core
  3. @pytest.mark.parametrize("type", (core.Mat4, core.Mat4D))
  4. def test_mat4_invert(type):
  5. mat = type((1, 0, 0, 0,
  6. 0, 1, 0, 0,
  7. 0, 0, 1, 0,
  8. 1, 2, 3, 1))
  9. inv = type()
  10. assert inv.invert_from(mat)
  11. assert inv == type(( 1, 0, 0, 0,
  12. 0, 1, 0, 0,
  13. 0, 0, 1, 0,
  14. -1, -2, -3, 1))
  15. assert (mat * inv).is_identity()
  16. assert (inv * mat).is_identity()