Again changes to the return values.
A python function with no return value returns 'None'
This commit is contained in:
parent
9a43c2e4c5
commit
feca9fe0a0
|
@ -108,23 +108,21 @@ class Rotation:
|
|||
def inverse(self):
|
||||
"""In-place inverse rotation/backward rotation"""
|
||||
self.quaternion.conjugate()
|
||||
return self
|
||||
|
||||
def inversed(self):
|
||||
"""Inverse rotation/backward rotation"""
|
||||
c = self.copy()
|
||||
c.inverse()
|
||||
return c
|
||||
return self.copy.inverse()
|
||||
|
||||
|
||||
def standardize(self):
|
||||
"""Ensure quaternion representation with positive q"""
|
||||
if self.quaternion.q < 0.0: self.quaternion.homomorph()
|
||||
"""In-place quaternion representation with positive q"""
|
||||
if self.quaternion.q < 0.0: self.quaternion.homomorph()
|
||||
return self
|
||||
|
||||
def standardized(self):
|
||||
"""Ensure quaternion representation with positive q"""
|
||||
c = self.copy()
|
||||
c.standardize()
|
||||
return c
|
||||
"""Quaternion representation with positive q"""
|
||||
return self.copy.standardize()
|
||||
|
||||
|
||||
def misorientation(self,other):
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
import numpy as np
|
||||
|
||||
P = -1 # convention (sed DOI:10.1088/0965-0393/23/8/083501)
|
||||
P = -1 # convention (see DOI:10.1088/0965-0393/23/8/083501)
|
||||
|
||||
####################################################################################################
|
||||
class Quaternion:
|
||||
|
@ -186,35 +186,32 @@ class Quaternion:
|
|||
|
||||
|
||||
def normalize(self):
|
||||
"""Normalizes in-place (no return value)"""
|
||||
"""Normalizes in-place"""
|
||||
d = self.magnitude()
|
||||
if d > 0.0: self /= d
|
||||
return self
|
||||
|
||||
def normalized(self):
|
||||
"""Returns normalized copy"""
|
||||
c = self.copy()
|
||||
c.normalize()
|
||||
return c
|
||||
return self.copy.normalize()
|
||||
|
||||
|
||||
def conjugate(self):
|
||||
"""Conjugates in-place (no return value)"""
|
||||
"""Conjugates in-place"""
|
||||
self.p = -self.p
|
||||
return self
|
||||
|
||||
def conjugated(self):
|
||||
"""Returns conjugated copy"""
|
||||
c = self.copy()
|
||||
c.conjugate()
|
||||
return c
|
||||
return self.copy.conjugate()
|
||||
|
||||
|
||||
def homomorph(self):
|
||||
"""Homomorphs in-place (no return value)"""
|
||||
"""Homomorphs in-place"""
|
||||
self.q = -self.q
|
||||
self.p = -self.p
|
||||
return self
|
||||
|
||||
def homomorphed(self):
|
||||
"""Returns homomorphed copy"""
|
||||
c = self.copy()
|
||||
c.homomorph()
|
||||
return c
|
||||
return self.copy.homomorph()
|
||||
|
|
Loading…
Reference in New Issue