) {
    Quaternion ret;
    ret.x_ = x_ * rhs.w_ + y_ * rhs.z_ - z_ * rhs.y_ + w_ * rhs.x_;
    ret.y_ = -x_ * rhs.z_ + y_ * rhs.w_ + z_ * rhs.x_ + w_ * rhs.y_;
    ret.z_ = x_ * rhs.y_ - y_ * rhs.x_ + z_ * rhs.w_ + w_ * rhs.z_;
    ret.w_ = -x_ * rhs.x_ - y_ * rhs.y_ - z_ * rhs.z_ + w_ * rhs.w_;
    return ret;
  }

  Quaternion& operator*=(const Quaternion rhs) {
    Quaternion ret;
    ret.x_ = x_ * rhs.w_ + y_ * rhs.z_ - z_ * rhs.y_ + w_ * rhs.x_;
    ret.y_ = -x_ * rhs.z_ + y_ * rhs.w_ + z_ * rhs.x_ + w_ * rhs.y_;
    ret.z_ = x_ * rhs.y_ - y_ * rhs.x_ + z_ * rhs.w_ + w_ * rhs.z_;
    ret.w_ = -x_ * rhs.x_ - y_ * rhs.y_ - z_ * rhs.z_ + w_ * rhs.w_;
    *this = ret;
    return *this;
  }

  Quaternion Conjugate() {
    x_ = -x_;
    y_ = -y_;
    z_ = -z_;
    return *this;
  }

  // Non destuctive version
  Quaternion Conjugated() {
    Quaternion ret;
    ret.x_ = -x_;
    ret.y_ = -y_;
    ret.z_ = -z_;
    ret.w_ = w_;
    return ret;
  }

  void ToMatrix(Mat4& mat) {
    float x2 = x_ * x_ * 2.0f;
    float y2 = y_ * y_ * 2.0f;
    float z2 = z_ * z_ * 2.0f;
    float xy = x_ * y_ * 2.0f;
    float yz = y_ * z_ * 2.0f;
    float zx = z_ * x_ * 2.0f;
    float xw = x_ * w_ * 2.0f;
    float yw = y_ * w_ * 2.0f;
    float zw = z_ * w_ * 2.0f;

    mat.f_[0] = 1.0f - y2 - z2;
    mat.f_[1] = xy + zw;
    mat.f_[2] = zx - yw;
    mat.f_[4] = xy - zw;
    mat.f_[5] = 1.0f - z2 - x2;
    mat.f_[6] = yz + xw;
    mat.f_[8] = zx + yw;
    mat.f_[9] = yz - xw;
    mat.f_[10] = 1.0f - x2 - y2;

    mat.f_[3] = mat.f_[7] = mat.f_[11] = mat.f_[12] = mat.f_[13] = mat.f_[14] =
        0.0f;
    mat.f_[15] = 1.0f;
  }

  void ToMatrixPreserveTranslate(Mat4& mat) {
    float x2 = x_ * x_ * 2.0f;
    float y2 = y_ * y_ * 2.0f;
    float z2 = z_ * z_ * 2.0f;
    float xy = x_ * y_ * 2.0f;
    float yz = y_ * z_ * 2.0f;
    float zx = z_ * x_ * 2.0f;
    float xw = x_ * w_ * 2.0f;
    float yw = y_ * w_ * 2.0f;
    float zw = z_ * w_ * 2.0f;

    mat.f_[0] = 1.0f - y2 - z2;
    mat.f_[1] = xy + zw;
    mat.f_[2] = zx - yw;
    mat.f_[4] = xy - zw;
    mat.f_[5] = 1.0f - z2 - x2;
    mat.f_[6] = yz + xw;
    mat.f_[8] = zx + yw;
    mat.f_[9] = yz - xw;
    mat.f_[10] = 1.0f - x2 - y2;

    mat.f_[3] = mat.f_[7] = mat.f_[11] = 0.0f;
    mat.f_[15] = 1.0f;
  }

  static Quaternion RotationAxis(const Vec3 axis, const float angle) {
    Quaternion ret;
    float s = sinf(angle / 2);
    ret.x_ = s * axis.x_;
    ret.y_ = s * axis.y_;
    ret.z_ = s * axis.z_;
    ret.w_ = cosf(angle / 2);
    return ret;
  }

  void Value(float&