Update core.py

This commit is contained in:
Olivier Martin 2018-12-19 13:01:30 -05:00 committed by GitHub
parent b5525b0f4e
commit 2e6e4ebb22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -178,7 +178,10 @@ def MatrixLog3(R):
elif acosinput < -1: elif acosinput < -1:
acosinput = -1 acosinput = -1
theta = np.arccos(acosinput) theta = np.arccos(acosinput)
return theta / 2.0 / np.sin(theta) * (R - np.array(R).T) if theta == 0:
return (R - np.array(R).T)/2
else:
return theta / 2.0 / np.sin(theta) * (R - np.array(R).T)
def RpToTrans(R, p): def RpToTrans(R, p):
"""Converts a rotation matrix and a position vector into homogeneous """Converts a rotation matrix and a position vector into homogeneous