in mujoco_worldgen/util/rotation.py [0:0]
def quat_mul(quat0, quat1):
assert quat0.shape == quat1.shape
assert quat0.shape[-1] == 4
w0 = quat0[..., 0]
x0 = quat0[..., 1]
y0 = quat0[..., 2]
z0 = quat0[..., 3]
w1 = quat1[..., 0]
x1 = quat1[..., 1]
y1 = quat1[..., 2]
z1 = quat1[..., 3]
w = w0 * w1 - x0 * x1 - y0 * y1 - z0 * z1
x = w0 * x1 + x0 * w1 + y0 * z1 - z0 * y1
y = w0 * y1 + y0 * w1 + z0 * x1 - x0 * z1
z = w0 * z1 + z0 * w1 + x0 * y1 - y0 * x1
quat = np.stack([w, x, y, z], axis=-1)
assert quat.shape == quat0.shape
return quat