Convert rotation matrixs to axis angles. Args: matrix (Union[torch.Tensor, numpy.ndarray]): input shape should be (..., 3, 3). ndim of input is unlimited. convention (str, optional): Convention string of three letters from {“x”, “y”, and “z”}. Def
(
matrix: Union[torch.Tensor, numpy.ndarray],
convention: str = 'xyz')
| 349 | |
| 350 | |
| 351 | def rotmat_to_aa( |
| 352 | matrix: Union[torch.Tensor, numpy.ndarray], |
| 353 | convention: str = 'xyz') -> Union[torch.Tensor, numpy.ndarray]: |
| 354 | """Convert rotation matrixs to axis angles. |
| 355 | |
| 356 | Args: |
| 357 | matrix (Union[torch.Tensor, numpy.ndarray]): input shape |
| 358 | should be (..., 3, 3). ndim of input is unlimited. |
| 359 | convention (str, optional): Convention string of three letters |
| 360 | from {“x”, “y”, and “z”}. Defaults to 'xyz'. |
| 361 | |
| 362 | Returns: |
| 363 | Union[torch.Tensor, numpy.ndarray]: shape would be (..., 3). |
| 364 | """ |
| 365 | if matrix.shape[-1] != 3 or matrix.shape[-2] != 3: |
| 366 | raise ValueError(f'Invalid rotation matrix shape f{matrix.shape}.') |
| 367 | t = Compose([matrix_to_quaternion, quaternion_to_axis_angle]) |
| 368 | return t(matrix) |
| 369 | |
| 370 | |
| 371 | def quat_to_ee(quaternions: Union[torch.Tensor, numpy.ndarray], |
no test coverage detected