Logo Search packages:      
Sourcecode: blender version File versions  Download package

btQuaternion btQuaternion::slerp ( const btQuaternion q,
const btScalar &  t 
) const [inline]

Return the quaternion which is the result of Spherical Linear Interpolation between this and the other quaternion.

Parameters:
q The other quaternion to interpolate with
t The ratio between this and q to interpolate. If t = 0 the result is this, if t=1 the result is q. Slerp interpolates assuming constant velocity.

Definition at line 259 of file btQuaternion.h.

References angle(), and btQuaternion().

      {
            btScalar theta = angle(q);
            if (theta != btScalar(0.0))
            {
                  btScalar d = btScalar(1.0) / btSin(theta);
                  btScalar s0 = btSin((btScalar(1.0) - t) * theta);
                  btScalar s1 = btSin(t * theta);   
                  return btQuaternion((m_floats[0] * s0 + q.x() * s1) * d,
                        (m_floats[1] * s0 + q.y() * s1) * d,
                        (m_floats[2] * s0 + q.z() * s1) * d,
                        (m_floats[3] * s0 + q.m_floats[3] * s1) * d);
            }
            else
            {
                  return *this;
            }
      }


Generated by  Doxygen 1.6.0   Back to index