Class TransformationMatrix

TransformationMatrix class

Represents 3x3 transformation matrix | A B 0 | | C D 0 | | TX TY 1 |. Transforms coordinates in the following way: x1 = Ax + Cy + TX; y1 = Bx + Dy + TY.

public class TransformationMatrix : ICloneable

Constructors

NameDescription
TransformationMatrix()Creates standard 1 to 1 transformation matrix: [ A B C D TX TY ] = [ 1, 0, 0, 1, 0, 0].
TransformationMatrix(double[])Accepts a transformation matrix with following array representation: [ A B C D TX TY ].

Properties

NameDescription
A { get; set; }Gets or sets A transformation matrix value.
B { get; set; }Gets or sets B transformation matrix value.
C { get; set; }Gets or sets C transformation matrix value.
D { get; set; }Gets or sets D transformation matrix value.
Item { get; }Provides access to underlying array.
TX { get; set; }Gets or sets TX transformation matrix value.
TY { get; set; }Gets or sets TY transformation matrix value.

Methods

NameDescription
Multiply(TransformationMatrix)Multiplies with another transformation matrix. Doesn’t change original transformation matrix, returns a new TransformationMatrix object.
Scale(double, double, out double, out double)Scales x and y with the transformation matrix: x1 = Ax + Cy; y1 = Bx + Dy.
ToArray()Allocates new array, copies the transformation matrix and returns it.
Transform(double, double, out double, out double)Transforms x and y with the transformation matrix: x1 = Ax + Cy + TX; y1 = Bx + Dy + TY.
UnScale(double, double, out double, out double)Scales back x1 and y1 and returns x and y before the transformation matrix.
UnTransform(double, double, out double, out double)Transforms back x1 and y1 and returns x and y before the transformation matrix.

See Also