quat->Eulers now returns always positive angles

This commit is contained in:
Philip Eisenlohr 2018-12-08 11:52:55 -05:00
parent eaf2c77903
commit b777253dd6
1 changed files with 3 additions and 2 deletions

View File

@ -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