#include <quaternion.h>
Definition at line 14 of file quaternion.h.
◆ Quaternion() [1/3]
impeller::Quaternion::Quaternion |
( |
| ) |
|
|
inline |
◆ Quaternion() [2/3]
◆ Quaternion() [3/3]
impeller::Quaternion::Quaternion |
( |
const Vector3 & |
axis, |
|
|
Scalar |
angle |
|
) |
| |
|
inline |
Definition at line 30 of file quaternion.h.
30 {
31 const auto sine = sin(angle * 0.5f);
35 w = cos(angle * 0.5f);
36 }
◆ Dot()
Definition at line 38 of file quaternion.h.
38 {
39 return x * q.x +
y * q.y +
z * q.z +
w * q.w;
40 }
◆ Invert()
◆ Length()
Scalar impeller::Quaternion::Length |
( |
| ) |
const |
|
inline |
Definition at line 42 of file quaternion.h.
SIN Vec< N, float > sqrt(const Vec< N, float > &x)
◆ Normalize()
Quaternion impeller::Quaternion::Normalize |
( |
| ) |
const |
|
inline |
◆ operator!=()
bool impeller::Quaternion::operator!= |
( |
const Quaternion & |
o | ) |
const |
|
inline |
Definition at line 85 of file quaternion.h.
85 {
86 return x != o.x ||
y != o.y ||
z != o.z ||
w != o.w;
87 }
◆ operator*() [1/3]
Definition at line 53 of file quaternion.h.
53 {
54 return {
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,
59 };
60 }
◆ operator*() [2/3]
◆ operator*() [3/3]
Definition at line 66 of file quaternion.h.
66 {
68 return v * v.Dot(vector) * 2 +
69 vector * (
w *
w - v.Dot(v)) +
70 v.Cross(vector) * 2 *
w;
71 }
◆ operator+()
Definition at line 73 of file quaternion.h.
73 {
74 return {
x + o.x,
y + o.y,
z + o.z,
w + o.w};
75 }
◆ operator-()
Definition at line 77 of file quaternion.h.
77 {
78 return {
x - o.x,
y - o.y,
z - o.z,
w - o.w};
79 }
◆ operator==()
bool impeller::Quaternion::operator== |
( |
const Quaternion & |
o | ) |
const |
|
inline |
Definition at line 81 of file quaternion.h.
81 {
82 return x == o.x &&
y == o.y &&
z == o.z &&
w == o.w;
83 }
◆ Slerp()
Definition at line 10 of file quaternion.cc.
10 {
11 double cosine =
Dot(to);
12 if (fabs(cosine) < 1.0 - 1
e-3 ) {
13
14
15
16 auto sine =
sqrt(1.0 - cosine * cosine);
17 auto angle = atan2(sine, cosine);
18 auto sineInverse = 1.0 / sine;
19 auto c0 = sin((1.0 -
time) * angle) * sineInverse;
20 auto c1 = sin(
time * angle) * sineInverse;
21 return *this * c0 + to * c1;
22 } else {
23
24
25
26 return (*
this * (1.0 -
time) + to *
time).Normalize();
27 }
28}
static double time(int loops, Benchmark *bench, Target *target)
Scalar Dot(const Quaternion &q) const
union { ... } impeller::Quaternion::@31 |
Scalar impeller::Quaternion::e[4] |
Scalar impeller::Quaternion::w = 1.0 |
Scalar impeller::Quaternion::x = 0.0 |
Scalar impeller::Quaternion::y = 0.0 |
Scalar impeller::Quaternion::z = 0.0 |
The documentation for this struct was generated from the following files: