Esempio n. 1
0
    def test_type(self):
        # Unit quaternion can be unitary or general:
        assert isinstance(GeneralQuaternion.unit(), GeneralQuaternion)
        assert isinstance(Quaternion.unit(), Quaternion)

        # Unit quaternion can not be unitary:
        assert isinstance(GeneralQuaternion.zero(), GeneralQuaternion)
        assert not isinstance(Quaternion.zero(), Quaternion)
        assert isinstance(Quaternion.zero(), GeneralQuaternion)

        assert isinstance(exp(GeneralQuaternion(1, 2, 3, 4)), GeneralQuaternion)
        assert isinstance(exp(Quaternion(1, 2, 3, 4)), Quaternion)

        assert isinstance(log(Quaternion(1, 2, 3, 4)), GeneralQuaternion)
        assert not isinstance(log(Quaternion(1, 2, 3, 4)), Quaternion)
Esempio n. 2
0
 def test_log_identity(self):
     assert log(Quaternion.unit()) == GeneralQuaternion.zero()
Esempio n. 3
0
 def test_exp_identity(self):
     assert exp(GeneralQuaternion.zero()) == Quaternion.unit()