(rot, dt, target_dt)
| 254 | |
| 255 | |
| 256 | def get_rot(rot, dt, target_dt): |
| 257 | rot = rot[..., [1, 2, 3, 0]] |
| 258 | nframe = rot.shape[0] |
| 259 | x = np.arange(nframe) * dt |
| 260 | x_target = np.arange(int(nframe * dt / target_dt)) * target_dt |
| 261 | |
| 262 | rotations = Rotation.from_quat(rot) |
| 263 | spline = RotationSpline(x, rotations) |
| 264 | |
| 265 | return spline(x_target, 0).as_quat()[:, [3, 0, 1, 2]] |
| 266 | |
| 267 | |
| 268 | if __name__ == '__main__': |