Ejemplo n.º 1
0
 /// <summary>
 /// Calculate the transpose of the given matrix.
 /// </summary>
 /// <param name="mat">The matrix to transpose.</param>
 /// <param name="result">The transpose of the given matrix.</param>
 public static void Transpose(ref Matrix4x2 mat, out Matrix2x4 result)
 {
     result.Row0.X = mat.Row0.X;
     result.Row0.Y = mat.Row1.X;
     result.Row0.Z = mat.Row2.X;
     result.Row0.W = mat.Row3.X;
     result.Row1.X = mat.Row0.Y;
     result.Row1.Y = mat.Row1.Y;
     result.Row1.Z = mat.Row2.Y;
     result.Row1.W = mat.Row3.Y;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Multiplies two instances.
        /// </summary>
        /// <param name="left">The left operand of the multiplication.</param>
        /// <param name="right">The right operand of the multiplication.</param>
        /// <param name="result">A new instance that is the result of the multiplication.</param>
        public static void Mult(ref Matrix2 left, ref Matrix2x4 right, out Matrix2x4 result)
        {
            float lM11 = left.Row0.X, lM12 = left.Row0.Y,
                  lM21 = left.Row1.X, lM22 = left.Row1.Y,
                  rM11 = right.Row0.X, rM12 = right.Row0.Y, rM13 = right.Row0.Z, rM14 = right.Row0.W,
                  rM21 = right.Row1.X, rM22 = right.Row1.Y, rM23 = right.Row1.Z, rM24 = right.Row1.W;

            result.Row0.X = (lM11 * rM11) + (lM12 * rM21);
            result.Row0.Y = (lM11 * rM12) + (lM12 * rM22);
            result.Row0.Z = (lM11 * rM13) + (lM12 * rM23);
            result.Row0.W = (lM11 * rM14) + (lM12 * rM24);
            result.Row1.X = (lM21 * rM11) + (lM22 * rM21);
            result.Row1.Y = (lM21 * rM12) + (lM22 * rM22);
            result.Row1.Z = (lM21 * rM13) + (lM22 * rM23);
            result.Row1.W = (lM21 * rM14) + (lM22 * rM24);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Multiplies two instances.
        /// </summary>
        /// <param name="left">The left operand of the multiplication.</param>
        /// <param name="right">The right operand of the multiplication.</param>
        /// <param name="result">A new instance that is the result of the multiplication.</param>
        public static void Mult(ref Matrix2x3 left, ref Matrix3x4 right, out Matrix2x4 result)
        {
            float lM11 = left.Row0.X, lM12 = left.Row0.Y, lM13 = left.Row0.Z,
                  lM21 = left.Row1.X, lM22 = left.Row1.Y, lM23 = left.Row1.Z,
                  rM11 = right.Row0.X, rM12 = right.Row0.Y, rM13 = right.Row0.Z, rM14 = right.Row0.W,
                  rM21 = right.Row1.X, rM22 = right.Row1.Y, rM23 = right.Row1.Z, rM24 = right.Row1.W,
                  rM31 = right.Row2.X, rm32 = right.Row2.Y, rM33 = right.Row2.Z, rM34 = right.Row2.W;

            result.Row0.X = ((lM11 * rM11) + (lM12 * rM21)) + (lM13 * rM31);
            result.Row0.Y = ((lM11 * rM12) + (lM12 * rM22)) + (lM13 * rm32);
            result.Row0.Z = ((lM11 * rM13) + (lM12 * rM23)) + (lM13 * rM33);
            result.Row0.W = ((lM11 * rM14) + (lM12 * rM24)) + (lM13 * rM34);
            result.Row1.X = ((lM21 * rM11) + (lM22 * rM21)) + (lM23 * rM31);
            result.Row1.Y = ((lM21 * rM12) + (lM22 * rM22)) + (lM23 * rm32);
            result.Row1.Z = ((lM21 * rM13) + (lM22 * rM23)) + (lM23 * rM33);
            result.Row1.W = ((lM21 * rM14) + (lM22 * rM24)) + (lM23 * rM34);
        }