[skip ci] disorientation may return full-fledged orientation obj and aux info, added rotation.standardize(d)

This commit is contained in:
Philip Eisenlohr 2019-04-18 18:05:46 -04:00
parent c4f56703a4
commit 4183eeaeca
1 changed files with 10 additions and 1 deletions

View File

@ -109,6 +109,15 @@ class Rotation:
return self.__class__(self.quaternion.conjugated())
def standardize(self):
"""Ensure quaternion representation with positive q"""
if self.quaternion.q < 0.0: self.quaternion.homomorph()
def standardized(self):
"""Ensure quaternion representation with positive q"""
return self.__class__(self.quaternion.homomorphed() if self.quaternion.q < 0.0 else self.quaternion)
def misorientation(self,other):
"""Misorientation"""
return other*self.inversed()
@ -920,7 +929,7 @@ class Orientation:
if breaker: break
if breaker: break
return (r, i,j, k == 1) if symmetries else r # disorientation ...
return (Orientation(r,self.symmetry), i,j, k == 1) if symmetries else r # disorientation ...
# ... own sym, other sym,
# self-->other: True, self<--other: False