Scilab Function
Last update : April 2007

rt_qinterp - interpolate unit-quaternions[view code]

Calling Sequence

qi = rt_qinterp(q1, q2, r)
QI = rt_qinterp(q1, q2, R)



The first form returns a unit quaternion that interpolates between q1 and q2 as r varies between 0 and 1 inclusively. This is a spherical linear interpolation (slerp) that can be interpreted as interpolation along a great circle arc on a sphere.

The second form returns a list of quaternions corresponding to successive values of R.


   // To show how two rotations described by two unit quaternions can be
   // interpolated at different fractions between them, the following code
   // could be used.

   q1 = rt_quaternion(rt_rotx(0.3)),        // first rotation
   q2 = rt_quaternion(rt_roty(-0.5)),       // second rotation

   // slerp at r = 0 should return q1
   qi1 = rt_qinterp(q1, q2, 0),             // qi1 == q1

   // slerp at r = 1 should return q2
   qi2 = rt_qinterp(q1, q2, 1),             // qi2 == q2

   // slerp at r = 0.3
   qi3 = rt_qinterp(q1, q2, 0.3),

   // A more direct approach...
   QI = rt_qinterp(q1, q2, [0, 1, 0.3]),    // QI == list(qi1, qi2, qi3)

   // error handling
   QI = rt_qinterp(q1, q2, [0, 1.1, 0.3]),  // R(2) > 1


See Also



original Matlab version by

Peter I. Corke CSIRO Manufacturing Science and Technology

Scilab implementation by

Matteo Morelli Interdepartmental Research Center "E. Piaggio", University of Pisa


Corke, P.I. "A Robotics Toolbox for MATLAB", IEEE Robotics and Automation Magazine, Volume 3(1), March 1996, pp. 24-32

K. Shoemake, "Animating rotation with quaternion curves", in Proceedings of ACM SIGGRAPH, (San Francisco), pp. 245-254, The Singer Company, Link Flight Simulator Division, 1985.

Get the Robotics Toolbox for Scilab/Scicos at Fast, secure and Free Open Source software downloads