Name
CL_rot_quatSlerp — Spherical linear interpolation between 2 quaternions
Calling Sequence
q = CL_rot_quatSlerp(q1,q2,t)
Description
-
Computes spherical linear interpolation (slerp) between quaternions q1 and
q2 (shortest way), given an interpolation parameter between 0 and
1 (t). Input quaternions are normed before any calculations.
CL_rot_quatSlerp(q1,q2,0)=q1 and CL_rot_quatSlerp(q1,q2,1)=q2
NOTE: q1 and q2 must be same size. In addition, to use this function in a vectorized way
there are two options:
1: N=P
2: N~=P with N=1 or P=1
NOTE: t<0 gives same result as t=0; t>1 gives same result as t=1.
- Last update : 27/6/2008
Parameters
- q1:
start quaternion (type quat, see CL_rot_defQuat) (size N)
- q2:
end quaternion (type quat) (size N)
- t:
interpolation parameter [0..1] (1xP)
Examples
q1 = CL_rot_defQuat([0.1 0.2 0.3 0.4]')
q2 = CL_rot_defQuat([0.2 0.3 0.4 0.5]')
q1_normed = q1./norm(q1)
q2_normed = q2./norm(q2)
q = CL_rot_quatSlerp(q1,q2,0)
qq = CL_rot_quatSlerp(q1,q2,1)
qqq = CL_rot_quatSlerp(q1,q2,0.5)