Exemple #1
0
    /// <summary>
    /// 平移旋转缩放矩阵
    /// </summary>
    /// <param name="pos"></param>
    /// <param name="q"></param>
    /// <param name="s"></param>
    /// <returns></returns>
    public static Matrix4x4d TRS(Vector3d pos, Quaterniond q, Vector3d s)
    {
        Matrix4x4d m = Quaterniond.QuaternionToMatrix(q);

        m[0] *= s[0];
        m[1] *= s[0];
        m[2] *= s[0];

        m[4] *= s[1];
        m[5] *= s[1];
        m[6] *= s[1];

        m[8]  *= s[2];
        m[9]  *= s[2];
        m[10] *= s[2];

        m[12] = pos[0];
        m[13] = pos[1];
        m[14] = pos[2];
        return(m);
    }