proper definition of homomorph

This commit is contained in:
Martin Diehl 2019-04-18 17:04:00 +02:00
parent 1904ac211e
commit c4f56703a4
2 changed files with 5 additions and 4 deletions

View File

@ -61,7 +61,9 @@ class Rotation:
Rotation: Details needed (active/passive), rotation of (3,3,3,3)-matrix should be considered
"""
if isinstance(other, Rotation): # rotate a rotation
return self.__class__((self.quaternion * other.quaternion).homomorph())
qu = self.quaternion * other.quaternion
if qu.q < 0: qu.homomorph()
return self.__class__(qu)
elif isinstance(other, np.ndarray):
if other.shape == (3,): # rotate a single (3)-vector
( x, y, z) = self.quaternion.p

View File

@ -201,7 +201,6 @@ class Quaternion:
def homomorph(self):
if self.q < 0.0:
self.q = -self.q
self.p = -self.p
return self