Class Matrix

Matrix class

Class represents transformation matrix.

public sealed class Matrix

Constructors

NameDescription
Matrix()Constructor creates stanrard 1 to 1 matrix: [ A B C D E F ] = [ 1, 0, 0, 1, 0, 0]
Matrix(double[])Constructor accepts a matrix with following array representation: [ A B C D E F ]
Matrix(float[])Constructor accepts a matrix with following array representation: [ A B C D E F ]
Matrix(Matrix)Constructor accepts a matrix to create a copy
Matrix(double, double, double, double, double, double)Initializes transformation matrix with specified coefficients.

Properties

NameDescription
A { get; set; }A member of the transformation matrix.
B { get; set; }B member of the transformation matrix.
C { get; set; }C member of the transformation matrix.
D { get; set; }D member of the transformation matrix.
Data { get; }Gets data of Matrix as array.
E { get; set; }E member of the transformation matrix.
Elements { get; }Elements of the matrix.
F { get; set; }F member of the transformation matrix.

Methods

NameDescription
static Rotation(double)Creates matrix for given rotation angle.
static Rotation(Rotation)Creates matrix for given rotation.
static Skew(double, double)Creates matrix for given rotation angle.
Add(Matrix)Adds matrix to other matrix.
override Equals(object)Compares matrix agains other object.
override GetHashCode()Hash-code for object.
Multiply(Matrix)Multiplies the matrix by other matrix.
Reverse()Calculates reverse matrix.
Scale(double, double, out double, out double)Scales x and y with the matrix using the following formula: x1 = Ax + Cy; y1 = Bx + Dy;
override ToString()Returns text reporesentation of the matrix.
Transform(Point)Transforms point using this matrix.
Transform(Rectangle)Transformes rectangle. If angle is not 90 * N degrees then bounding rectangle is returned.
Transform(double, double, out double, out double)Transforms coordinates using this matrix.
UnScale(double, double, out double, out double)Scales back x1 and y1 and returns x and y before the matrix transformation using the following formula: x = (D * x1 - C * y1) / (A * D - C * B); y = (A* y1 - B* x1) / (A* D - C* B);
UnTransform(double, double, out double, out double)Transforms back x1 and y1 and returns x and y before the matrix transformation using the following formula: x = (D * x1 - C * y1 + C * F) / (A * D - C * B) y = (A * y1 - B * x1 + B * E) / (A * D - C * B).
static GetAngle(Rotation)Transaltes rotation into angle (degrees)

See Also