5#ifndef FLUTTER_IMPELLER_GEOMETRY_QUATERNION_H_
6#define FLUTTER_IMPELLER_GEOMETRY_QUATERNION_H_
28 :
x(px),
y(py),
z(pz),
w(pw) {}
31 const auto sine = sin(angle * 0.5f);
35 w = cos(angle * 0.5f);
39 return x * q.
x +
y * q.
y +
z * q.
z +
w * q.
w;
55 w * o.
x +
x * o.
w +
y * o.
z -
z * o.
y,
56 w * o.
y +
y * o.
w +
z * o.
x -
x * o.
z,
57 w * o.
z +
z * o.
w +
x * o.
y -
y * o.
x,
58 w * o.
w -
x * o.
x -
y * o.
y -
z * o.
z,
68 return v * v.
Dot(vector) * 2 +
69 vector * (
w *
w - v.
Dot(v)) +
74 return {
x + o.
x,
y + o.
y,
z + o.
z,
w + o.
w};
78 return {
x - o.
x,
y - o.
y,
z - o.
z,
w - o.
w};
82 return x == o.
x &&
y == o.
y &&
z == o.
z &&
w == o.
w;
86 return x != o.
x ||
y != o.
y ||
z != o.
z ||
w != o.
w;
96 out <<
"(" << q.
x <<
", " << q.
y <<
", " << q.
z <<
", " << q.
w <<
")";
SIN Vec< N, float > sqrt(const Vec< N, float > &x)
std::ostream & operator<<(std::ostream &out, const impeller::Color &c)
static double time(int loops, Benchmark *bench, Target *target)
Quaternion operator+(const Quaternion &o) const
Quaternion operator*(const Quaternion &o) const
bool operator==(const Quaternion &o) const
Quaternion Slerp(const Quaternion &to, double time) const
Vector3 operator*(Vector3 vector) const
Quaternion Invert() const
Quaternion(Scalar px, Scalar py, Scalar pz, Scalar pw)
Quaternion(const Vector3 &axis, Scalar angle)
Quaternion Normalize() const
bool operator!=(const Quaternion &o) const
Quaternion operator*(Scalar scale) const
Quaternion operator-(const Quaternion &o) const
Scalar Dot(const Quaternion &q) const
constexpr Vector3 Cross(const Vector3 &other) const
constexpr Scalar Dot(const Vector3 &other) const