CgExamples.Gl_14_bulge.transform C# (CSharp) Метод

transform() статический приватный Метод

Simple 4x4 matrix by 4-component column vector multiply.
static private transform ( float &dst, float mat, float vec ) : void
dst float
mat float
vec float
Результат void
        static void transform(ref float[] dst, float[] mat, float[] vec)
        {
            double[] tmp = new double[4];
            double invW;
            int i;

            for (i = 0; i < 4; i++)
            {
                tmp[i] = mat[i * 4 + 0] * vec[0] +
                         mat[i * 4 + 1] * vec[1] +
                         mat[i * 4 + 2] * vec[2] +
                         mat[i * 4 + 3] * vec[3];
            }
            invW = 1 / tmp[3];
            /* Apply perspective divide and copy to dst (so dst can vec). */
            for (i = 0; i < 3; i++)
                dst[i] = (float)(tmp[i] * tmp[3]);
            dst[3] = 1;
        }