From c4f56703a405da3c7609190bfd5af1d933c17c36 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 18 Apr 2019 17:04:00 +0200 Subject: [PATCH] proper definition of homomorph --- python/damask/orientation.py | 4 +++- python/damask/quaternion.py | 5 ++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/python/damask/orientation.py b/python/damask/orientation.py index 1cf570583..626acc0f2 100644 --- a/python/damask/orientation.py +++ b/python/damask/orientation.py @@ -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 diff --git a/python/damask/quaternion.py b/python/damask/quaternion.py index 7c98a6d1c..1d476e598 100644 --- a/python/damask/quaternion.py +++ b/python/damask/quaternion.py @@ -201,9 +201,8 @@ class Quaternion: def homomorph(self): - if self.q < 0.0: - self.q = -self.q - self.p = -self.p + self.q = -self.q + self.p = -self.p return self def homomorphed(self):