MCPcopy Create free account
hub / github.com/MotrixLab/ViMoGen / mat3x3_to_axis_angle

Function mat3x3_to_axis_angle

motion_rep/rotation_transform.py:70–80  ·  view source on GitHub ↗

Convert 3x3 rotation matrix to 3d vector of axis-angle rotation. Shape: - Input: :Torch:`(N, 3, 3)` - Output: :Torch:`(N, 3)`

(rot_mat)

Source from the content-addressed store, hash-verified

68 return rot_mat[:, :3, :3]
69
70def mat3x3_to_axis_angle(rot_mat):
71 """
72 Convert 3x3 rotation matrix to 3d vector of axis-angle rotation.
73 Shape:
74 - Input: :Torch:`(N, 3, 3)`
75 - Output: :Torch:`(N, 3)`
76 """
77 rot_mat = torch.cat([rot_mat, torch.zeros((rot_mat.shape[0], 3, 1), device=rot_mat.device).float()], 2)
78 axis_angle = tgm.rotation_matrix_to_angle_axis(rot_mat).reshape(-1, 3) # axis-angle
79 axis_angle[torch.isnan(axis_angle)] = 0.0
80 return axis_angle
81
82def quaternion_to_axis_angle(quaternion):
83 """

Callers 2

motion_rep_to_SMPLFunction · 0.85
apply_rotationFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected