(cont6d)
| 318 | |
| 319 | |
| 320 | def 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 | |
| 339 | def cont6d_to_matrix_np(cont6d): |
no outgoing calls
no test coverage detected