예제 #1
0
파일: Mat4d.cs 프로젝트: anegostudios/vsapi
        /// <summary>
        /// Multiply the matrix with a vec4. Reference: http://mathinsight.org/matrix_vector_multiplication
        ///
        /// </summary>
        /// <param name="matrix"></param>
        /// <param name="inVal"></param>
        /// <param name="outVal"></param>
        /// <returns></returns>
        public static void MulWithVec4(double[] matrix, Vec4d inVal, Vec4d outVal)
        {
            outVal.Set(0, 0, 0, 0);

            for (int row = 0; row < 4; row++)
            {
                for (int col = 0; col < 4; col++)
                {
                    outVal[row] += matrix[4 * col + row] * inVal[col];
                }
            }
        }