Merge pull request #12 from omartin2010/patch-2
Update MatrixLog6 and MatrixLog3
This commit is contained in:
commit
20aeea8316
|
|
@ -173,8 +173,8 @@ def MatrixLog3(R):
|
|||
return VecToso3(np.pi * omg)
|
||||
else:
|
||||
acosinput = (np.trace(R) - 1) / 2.0
|
||||
if acosinput > 1:
|
||||
acosinput = 1
|
||||
if acosinput >= 1:
|
||||
acosinput = 0.99999
|
||||
elif acosinput < -1:
|
||||
acosinput = -1
|
||||
theta = np.arccos(acosinput)
|
||||
|
|
@ -392,18 +392,13 @@ def MatrixLog6(T):
|
|||
[0, 0, 0, 0]])
|
||||
"""
|
||||
R, p = TransToRp(T)
|
||||
if NearZero(np.linalg.norm(R - np.eye(3))):
|
||||
return np.r_[np.c_[np.zeros((3, 3)),
|
||||
[T[0][3], T[1][3], T[2][3]]],
|
||||
[[0, 0, 0, 0]]]
|
||||
else:
|
||||
acosinput = (np.trace(R) - 1) / 2.0
|
||||
if acosinput > 1:
|
||||
acosinput = 1
|
||||
if acosinput >= 1:
|
||||
acosinput = 0.99999
|
||||
elif acosinput < -1:
|
||||
acosinput = -1
|
||||
theta = np.arccos(acosinput)
|
||||
omgmat = MatrixLog3(R)
|
||||
omgmat = np.array(MatrixLog3(R), dtype=np.float64)
|
||||
return np.r_[np.c_[omgmat,
|
||||
np.dot(np.eye(3) - omgmat / 2.0 \
|
||||
+ (1.0 / theta - 1.0 / np.tan(theta / 2.0) / 2) \
|
||||
|
|
|
|||
Loading…
Reference in New Issue