Quaternion interpolation between two quaternions
Use interpolation to calculate quaternion between
p=[1.0 0 1.0 0] and
0 1.0 0] using the
SLERP method. This
example uses the
quatnormalize function to first-normalize
the two quaternions to
pn = quatnormalize([1.0 0 1.0 0]) qn = quatnormalize([-1.0 0 1.0 0]) qi = quatinterp(pn,qn,0.5,'slerp')
pn = 0.7071 0 0.7071 0 qn = -0.7071 0 0.7071 0 qi = 0 0 1 0
p— First-normalized quaternion
First normalized quaternion for which to calculate the interpolation, specified as an M-by-4 matrix containing M quaternions. This quaternion must be a normalized quaternion.
Second normalized quaternion for which to calculate the interpolation, specified as an M-by-4 matrix containing M quaternions. This quaternion must be a normalized quaternion.
f— Interval fraction
Interval fraction by which to calculate the quaternion interpolation,
specified as an M-by-1 matrix containing M fractions
f varies between 0 and 1. It represents
the intermediate rotation of the quaternion to be calculated.
If f equals
0, qi equals qp.
If f is between
1, qi equals
If f equals
1, qi equals qn.
method— Quaternion interpolation method
Quaternion interpolation method to calculate the quaternion interpolation. These methods have different rotational velocities, depending on the interval fraction. For more information on interval fractions, see http://web.mit.edu/2.998/www/QuaternionReport1.pdf.
Quaternion slerp. Spherical linear quaternion interpolation method. This method is most accurate, but also most computation intense.
Quaternion lerp. Linear quaternion interpolation method. This method is the quickest, but is also least accurate. The method does not always generate normalized output.
Normalized quaternion linear interpolation method.
qi— Interpolation of quaternion
Interpolation of quaternion.