示例#1
0
    // Convert an array of rotation vectors back to quaternions
    public static Quaternion[] RotVecsToQuats(Vector3[] rotVecs, Quaternion q0)
    {
        Quaternion[] quaternions = new Quaternion[rotVecs.Length - 1];
        Quaternion   qProd       = q0;

        for (int i = 0; i < rotVecs.Length - 1; i++)
        {
            for (int j = 0; j < i - 1; j++)
            {
                qProd *= QuaternionUtil.Exp(rotVecs[j + 1] - rotVecs[j]);
            }
            quaternions[i] = qProd;
            qProd          = q0;
        }

        return(quaternions);
    }