parent
2e6e4ebb22
commit
fcaac5c5c7
|
|
@ -173,14 +173,11 @@ def MatrixLog3(R):
|
||||||
return VecToso3(np.pi * omg)
|
return VecToso3(np.pi * omg)
|
||||||
else:
|
else:
|
||||||
acosinput = (np.trace(R) - 1) / 2.0
|
acosinput = (np.trace(R) - 1) / 2.0
|
||||||
if acosinput > 1:
|
if acosinput >= 1:
|
||||||
acosinput = 1
|
acosinput = 0.99999
|
||||||
elif acosinput < -1:
|
elif acosinput < -1:
|
||||||
acosinput = -1
|
acosinput = -1
|
||||||
theta = np.arccos(acosinput)
|
theta = np.arccos(acosinput)
|
||||||
if theta == 0:
|
|
||||||
return (R - np.array(R).T)/2
|
|
||||||
else:
|
|
||||||
return theta / 2.0 / np.sin(theta) * (R - np.array(R).T)
|
return theta / 2.0 / np.sin(theta) * (R - np.array(R).T)
|
||||||
|
|
||||||
def RpToTrans(R, p):
|
def RpToTrans(R, p):
|
||||||
|
|
@ -393,14 +390,9 @@ def MatrixLog6(T):
|
||||||
[0, 0, 0, 0]])
|
[0, 0, 0, 0]])
|
||||||
"""
|
"""
|
||||||
R, p = TransToRp(T)
|
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
|
acosinput = (np.trace(R) - 1) / 2.0
|
||||||
if acosinput > 1:
|
if acosinput >= 1:
|
||||||
acosinput = 1
|
acosinput = 0.99999
|
||||||
elif acosinput < -1:
|
elif acosinput < -1:
|
||||||
acosinput = -1
|
acosinput = -1
|
||||||
theta = np.arccos(acosinput)
|
theta = np.arccos(acosinput)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue