From b777253dd64997a0f97717636fb221ff47fa5d83 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Sat, 8 Dec 2018 11:52:55 -0500 Subject: [PATCH] quat->Eulers now returns always positive angles --- lib/damask/orientation.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/damask/orientation.py b/lib/damask/orientation.py index 6fd0993ea..7131d39e3 100644 --- a/lib/damask/orientation.py +++ b/lib/damask/orientation.py @@ -263,8 +263,8 @@ class Quaternion: self.normalize() s = math.sqrt(1. - self.q**2) - x = 2*self.q**2 - 1. - y = 2*self.q * s + x = 2.*self.q**2 - 1. + y = 2.*self.q * s angle = math.atan2(y,x) if angle < 0.0: @@ -300,6 +300,7 @@ class Quaternion: math.atan2((P*self.q*self.p[1]+self.p[0]*self.p[2])/chi,( self.p[1]*self.p[2]-P*self.q*self.p[0])/chi), ]) + eulers %= 2.0*math.pi return np.degrees(eulers) if degrees else eulers