test_compose_matrix.py 824 B

1234567891011121314151617181920212223242526
  1. from panda3d import core
  2. import pytest
  3. @pytest.mark.parametrize("coordsys", (core.CS_zup_right, core.CS_yup_right, core.CS_zup_left, core.CS_yup_left))
  4. def test_compose_matrix(coordsys):
  5. scale = core.LVecBase3(1.2, 0.5, 2)
  6. hpr = core.LVecBase3(45, -90, 12.5)
  7. shear = core.LVecBase3(0, 0, 0)
  8. mat = core.LMatrix3()
  9. core.compose_matrix(mat, scale, shear, hpr, coordsys)
  10. new_scale = core.LVecBase3()
  11. new_hpr = core.LVecBase3()
  12. new_shear = core.LVecBase3()
  13. core.decompose_matrix(mat, new_scale, new_shear, new_hpr, coordsys)
  14. assert new_scale.almost_equal(scale)
  15. assert new_shear.almost_equal(shear)
  16. quat = core.LQuaternion()
  17. quat.set_hpr(hpr, coordsys)
  18. new_quat = core.LQuaternion()
  19. new_quat.set_hpr(new_hpr, coordsys)
  20. assert quat.is_same_direction(new_quat)