This method takes four control points, which are supplied to the inputs q0, q1, q2, and q3, and alters their values to find a curve that flows along the shortest path. The values of q0, q2, and q3 are calculated as shown below.
Note: In the preceding example, Ln is the application programming interface (API) method Quaternion.Ln, and Exp is the API method Quaternion.Exp.
Examples
The following example shows how to use a set of quaternion keys (Q0, Q1, Q2, Q3) to compute the inner quadrangle points (A, B, C). This ensures that the tangents are continuous across adjacent segments.
A B
Q0 Q1 Q2 Q3
The following C# code example shows how you can interpolate between Q1 and Q2.
[C#] // Rotation about the z-axis
Quaternion Q0 = new Quaternion(0f, 0f, 0.707f, -.707f);
Quaternion Q1 = new Quaternion(0f, 0f, 0.000f, 1.000f);
Quaternion Q2 = new Quaternion(0f, 0f, 0.707f, 0.707f);
Quaternion Q3 = new Quaternion(0f, 0f, 1.000f, 0.000f);
Quaternion A = new Quaternion();
Quaternion B = new Quaternion();
Quaternion C = new Quaternion();
Quaternion Qt = new Quaternion();
Single time = 0.5f;
Quaternion.SquadSetup(ref A, ref B, ref C, Q0, Q1, Q2, Q3);
Qt = Quaternion.Squad(Q1, A, B, C, time);
Note:
C is +/- Q2 depending on the result of the function
Qt is the result of the function
The result is a rotation of 45 degrees around the z-axis for time = 0.5.