Go to the documentation of this file.
8 inline float clamp(
float x,
float a,
float b) {
9 return x <
a ?
a : (x >
b ?
b : x);
17 float dot = v0.
dot(v1);
19 const float DOT_THRESHOLD = 0.9995f;
20 if (dot > DOT_THRESHOLD)
23 q.
x = (1 - alpha) * v0.
getX() + alpha * v1.
getX();
24 q.
y = (1 - alpha) * v0.
getY() + alpha * v1.
getY();
25 q.
z = (1 - alpha) * v0.
getZ() + alpha * v1.
getZ();
26 q.
w = (1 - alpha) * v0.
getW() + alpha * v1.
getW();
31 dot =
clamp(dot, -1.0f, 1.0f);
33 float theta_0 = acosf(dot);
34 float theta = theta_0*alpha;
39 return v0*cos(theta) + v2*sin(theta);
68 cache_.getLowerUpper(
t, lower, upper);
92 double dt1 =
t.seconds() - lower->first.seconds();
93 double t_diff = upper->first.seconds() - lower->first.seconds();
95 float alpha = dt1 / t_diff;
void setRotation(const QuaternionT< T > &q)
void interpolate(const geo::Transform &t1, const geo::Transform &t2, float alpha, geo::Pose3D &result)
geo::Quaternion slerp(const geo::Quaternion &v0, const geo::Quaternion &v1, float alpha)
std::map< Time, T >::const_iterator const_iterator
float clamp(float x, float a, float b)
T dot(const QuaternionT &q) const