(quat, vec)
return quat_mul(quat_mul(quat, qvec), quat_conj(quat))[1:]
Rotate a vector by a quaternion.

  Args:
    quat: A quaternion [w, i, j, k].
    vec: A 3-vector representing a position.

  Returns:
    The rotated vector.
Rotate a vector by a quaternion.
Rotate a vector by a quaternion .
def quat_rotate(quat, vec):
  """Rotate a vector by a quaternion.

  Args:
    quat: A quaternion [w, i, j, k].
    vec: A 3-vector representing a position.

  Returns:
    The rotated vector.
  """
  qvec = np.hstack([[0], vec])
  return quat_mul(quat_mul(quat, qvec), quat_conj(quat))[1:]
def quat_rotate ( quat , vec ) : qvec = np . hstack ( [ [ 0 ] , vec ] ) return quat_mul ( quat_mul ( quat , qvec ) , quat_conj ( quat ) ) [ 1 : ]