added option to return angleAxis as flat list
This commit is contained in:
parent
d7f505f24e
commit
3d7a73a0de
|
@ -257,7 +257,8 @@ class Quaternion:
|
||||||
])
|
])
|
||||||
|
|
||||||
def asAngleAxis(self,
|
def asAngleAxis(self,
|
||||||
degrees = False):
|
degrees = False,
|
||||||
|
flat = False):
|
||||||
if self.q > 1.:
|
if self.q > 1.:
|
||||||
self.normalize()
|
self.normalize()
|
||||||
|
|
||||||
|
@ -270,8 +271,12 @@ class Quaternion:
|
||||||
angle *= -1.
|
angle *= -1.
|
||||||
s *= -1.
|
s *= -1.
|
||||||
|
|
||||||
return (np.degrees(angle) if degrees else angle,
|
if flat:
|
||||||
np.array([1.0, 0.0, 0.0] if np.abs(angle) < 1e-6 else self.p / s))
|
return np.hstack((np.degrees(angle) if degrees else angle,
|
||||||
|
np.array([1.0, 0.0, 0.0] if np.abs(angle) < 1e-6 else self.p / s)))
|
||||||
|
else:
|
||||||
|
return (np.degrees(angle) if degrees else angle,
|
||||||
|
np.array([1.0, 0.0, 0.0] if np.abs(angle) < 1e-6 else self.p / s))
|
||||||
|
|
||||||
def asRodrigues(self):
|
def asRodrigues(self):
|
||||||
return np.inf*np.ones(3) if self.q == 0.0 else self.p/self.q
|
return np.inf*np.ones(3) if self.q == 0.0 else self.p/self.q
|
||||||
|
@ -749,8 +754,9 @@ class Orientation:
|
||||||
rodrigues = property(asRodrigues)
|
rodrigues = property(asRodrigues)
|
||||||
|
|
||||||
def asAngleAxis(self,
|
def asAngleAxis(self,
|
||||||
degrees = False):
|
degrees = False,
|
||||||
return self.quaternion.asAngleAxis(degrees)
|
flat = False):
|
||||||
|
return self.quaternion.asAngleAxis(degrees,flat)
|
||||||
angleAxis = property(asAngleAxis)
|
angleAxis = property(asAngleAxis)
|
||||||
|
|
||||||
def asMatrix(self):
|
def asMatrix(self):
|
||||||
|
|
Loading…
Reference in New Issue