Esempio n. 1
0
        /// <summary>
        /// Multiplies the two matrices.
        /// </summary>
        /// <param name="left">First matrix to multiply.</param>
        /// <param name="right">Second matrix to multiply.</param>
        /// <returns>Product of the multiplication.</returns>
        public static Matrix2f Multiply(Matrix2x3f left, Matrix3x2f right)
        {
            Matrix2f res;

            Multiply(ref left, ref right, out res);
            return(res);
        }
Esempio n. 2
0
        /// <summary>
        /// Transforms the vector by the matrix.
        /// </summary>
        /// <param name="v">Vector2 to transform.  Considered to be a row vector for purposes of multiplication.</param>
        /// <param name="matrix">Matrix to use as the transformation.</param>
        /// <param name="result">Row vector product of the transformation.</param>
        public static void Transform(ref Vector3f v, ref Matrix3x2f matrix, out Vector2f result)
        {
#if !WINDOWS
            result = new Vector2f();
#endif
            result.X = v.X * matrix.M11 + v.Y * matrix.M21 + v.Z * matrix.M31;
            result.Y = v.X * matrix.M12 + v.Y * matrix.M22 + v.Z * matrix.M32;
        }
Esempio n. 3
0
        /// <summary>
        /// Multiplies the two matrices.
        /// </summary>
        /// <param name="left">First matrix to multiply.</param>
        /// <param name="right">Second matrix to multiply.</param>
        /// <param name="result">Product of the multiplication.</param>
        public static void Multiply(ref Matrix2x3f left, ref Matrix3x2f right, out Matrix2f result)
        {
            result.M11 = left.M11 * right.M11 + left.M12 * right.M21 + left.M13 * right.M31;
            result.M12 = left.M11 * right.M12 + left.M12 * right.M22 + left.M13 * right.M32;

            result.M21 = left.M21 * right.M11 + left.M22 * right.M21 + left.M23 * right.M31;
            result.M22 = left.M21 * right.M12 + left.M22 * right.M22 + left.M23 * right.M32;
        }
Esempio n. 4
0
 public static void Validate(this Matrix3x2f m)
 {
     if (IsInvalid(m.M11) || IsInvalid(m.M12) ||
         IsInvalid(m.M21) || IsInvalid(m.M22) ||
         IsInvalid(m.M31) || IsInvalid(m.M32))
     {
         throw new NotFiniteNumberException("Invalid value.");
     }
 }
Esempio n. 5
0
 /// <summary>
 /// Computes the transposed matrix of a matrix.
 /// </summary>
 /// <param name="matrix">Matrix to transpose.</param>
 /// <param name="result">Transposed matrix.</param>
 public static void Transpose(ref Matrix2x3f matrix, out Matrix3x2f result)
 {
     result = matrix.Transposed;
 }