def isrot(rot, dtest=False):
"""
ISROT Test if SO(2) or SO(3) rotation matrix
ISROT(rot) is true if the argument if of dimension 2x2, 2x2xN, 3x3, or 3x3xN, else false (0).
ISROT(rot, 'valid') as above, but also checks the validity of the rotation.
See also ISHOMOG, ISROT2, ISVEC.
"""
if type(rot) is np.matrix:
rot = [rot]
if type(rot) is list:
for each in rot:
try:
assert type(each) is np.matrix
assert each.shape == (3, 3)
npt.assert_almost_equal(np.linalg.det(each), 1)
except AssertionError:
return False
return True
评论列表
文章目录