/// <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); }
public static void Validate(this Matrix2x3f m) { if (IsInvalid(m.M11) || IsInvalid(m.M12) || IsInvalid(m.M13) || IsInvalid(m.M21) || IsInvalid(m.M22) || IsInvalid(m.M23)) { throw new NotFiniteNumberException("Invalid value."); } }
/// <summary> /// Transforms the vector by the matrix. /// </summary> /// <param name="v">Vector2 to transform. Considered to be a column vector for purposes of multiplication.</param> /// <param name="matrix">Matrix to use as the transformation.</param> /// <param name="result">Column vector product of the transformation.</param> public static void Transform(ref Vector3f v, ref Matrix2x3f matrix, out Vector2f result) { #if !WINDOWS result = new Vector2f(); #endif result.X = matrix.M11 * v.X + matrix.M12 * v.Y + matrix.M13 * v.Z; result.Y = matrix.M21 * v.X + matrix.M22 * v.Y + matrix.M23 * v.Z; }
/// <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; }
/// <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 Matrix3x2f matrix, out Matrix2x3f result) { result = matrix.Transposed; }