MCPcopy Create free account
hub / github.com/MotrixLab/MotionDiffuse / cont6d_to_matrix

Function cont6d_to_matrix

text2motion/utils/quaternion.py:320–336  ·  view source on GitHub ↗
(cont6d)

Source from the content-addressed store, hash-verified

318
319
320def cont6d_to_matrix(cont6d):
321 assert cont6d.shape[-1] == 6, "The last dimension must be 6"
322 x_raw = cont6d[..., 0:3]
323 y_raw = cont6d[..., 3:6]
324
325 x = x_raw / torch.norm(x_raw, dim=-1, keepdim=True)
326 z = torch.cross(x, y_raw, dim=-1)
327 z = z / torch.norm(z, dim=-1, keepdim=True)
328
329 y = torch.cross(z, x, dim=-1)
330
331 x = x[..., None]
332 y = y[..., None]
333 z = z[..., None]
334
335 mat = torch.cat([x, y, z], dim=-1)
336 return mat
337
338
339def cont6d_to_matrix_np(cont6d):

Callers 2

cont6d_to_matrix_npFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected