11 double cosine =
Dot(to);
12 if (fabs(cosine) < 1.0 - 1
e-3 ) {
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;
SIN Vec< N, float > sqrt(const Vec< N, float > &x)
static double time(int loops, Benchmark *bench, Target *target)
Quaternion Slerp(const Quaternion &to, double time) const
Quaternion Normalize() const
Scalar Dot(const Quaternion &q) const