Пример #1
0
 /// <summary>
 /// Multiplies two matrices.
 /// </summary>
 /// <param name="a">A <see cref="Matrix2D"/> instance.</param>
 /// <param name="b">A <see cref="Matrix2D"/> instance.</param>
 /// <returns>A new <see cref="Matrix2D"/> instance containing the result.</returns>
 public static Matrix2D operator*(Matrix2D a, Matrix2D b)
 {
     return(Matrix2D.Multiply(a, b));
 }
Пример #2
0
 /// <summary>
 /// Transforms a given vector by a matrix.
 /// </summary>
 /// <param name="matrix">A <see cref="Matrix2D"/> instance.</param>
 /// <param name="vector">A <see cref="Vector2"/> instance.</param>
 /// <returns>A new <see cref="Vector2"/> instance containing the result.</returns>
 public static Vector2 operator*(Matrix2D matrix, Vector2 vector)
 {
     return(Matrix2D.Transform(matrix, vector));
 }
Пример #3
0
 /// <summary>
 /// Subtracts a matrix from a matrix.
 /// </summary>
 /// <param name="a">A <see cref="Matrix2D"/> instance.</param>
 /// <param name="b">A <see cref="Matrix2D"/> instance.</param>
 /// <returns>A new <see cref="Matrix2D"/> instance containing the difference.</returns>
 public static Matrix2D operator-(Matrix2D a, Matrix2D b)
 {
     return(Matrix2D.Subtract(a, b));
 }
Пример #4
0
 /// <summary>
 /// Subtracts a scalar from a matrix.
 /// </summary>
 /// <param name="a">A <see cref="Matrix2D"/> instance.</param>
 /// <param name="s">A scalar.</param>
 /// <returns>A new <see cref="Matrix2D"/> instance containing the difference.</returns>
 public static Matrix2D operator-(Matrix2D a, double s)
 {
     return(Matrix2D.Subtract(a, s));
 }
Пример #5
0
 /// <summary>
 /// Adds a matrix and a scalar.
 /// </summary>
 /// <param name="a">A <see cref="Matrix2D"/> instance.</param>
 /// <param name="s">A scalar.</param>
 /// <returns>A new <see cref="Matrix2D"/> instance containing the sum.</returns>
 public static Matrix2D operator+(double s, Matrix2D a)
 {
     return(Matrix2D.Add(a, s));
 }
Пример #6
0
 /// <summary>
 /// Adds two matrices.
 /// </summary>
 /// <param name="a">A <see cref="Matrix2D"/> instance.</param>
 /// <param name="b">A <see cref="Matrix2D"/> instance.</param>
 /// <returns>A new <see cref="Matrix2D"/> instance containing the sum.</returns>
 public static Matrix2D operator+(Matrix2D a, Matrix2D b)
 {
     return(Matrix2D.Add(a, b));
 }
Пример #7
0
 /// <summary>
 /// Transforms a given vector by a matrix and put the result in a vector.
 /// </summary>
 /// <param name="matrix">A <see cref="Matrix2D"/> instance.</param>
 /// <param name="vector">A <see cref="Vector2"/> instance.</param>
 /// <param name="result">A <see cref="Vector2"/> instance to hold the result.</param>
 public static void Transform(Matrix2D matrix, Vector2 vector, ref Vector2 result)
 {
     result.X = (matrix.M11 * vector.X) + (matrix.M12 * vector.Y);
     result.Y = (matrix.M21 * vector.X) + (matrix.M22 * vector.Y);
 }
Пример #8
0
 /// <summary>
 /// Transforms a given vector by a matrix.
 /// </summary>
 /// <param name="matrix">A <see cref="Matrix2D"/> instance.</param>
 /// <param name="vector">A <see cref="Vector2"/> instance.</param>
 /// <returns>A new <see cref="Vector2"/> instance containing the result.</returns>
 public static Vector2 Transform(Matrix2D matrix, Vector2 vector)
 {
     return(new Vector2(
                (matrix.M11 * vector.X) + (matrix.M12 * vector.Y),
                (matrix.M21 * vector.X) + (matrix.M22 * vector.Y)));
 }
Пример #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Matrix2D"/> class using a given matrix.
 /// </summary>
 public Matrix2D(Matrix2D m)
 {
     _m11 = m.M11; _m12 = m.M12;
     _m21 = m.M21; _m22 = m.M22;
 }