# class HexaPDF::Content::TransformationMatrix

Parent Object HexaPDF::Utils::MathHelpers

A `TransformationMatrix` is a matrix used in PDF graphics operations to specify the relationship between different coordinate systems.

All matrix operations modify the matrix in place. So if the original matrix should be preserved, duplicate it before the operation.

It is important to note that the matrix transforms from the new coordinate system to the untransformed coordinate system. This means that after the transformation all coordinates are specified in the new, transformed coordinate system and to get the untransformed coordinates the matrix needs to be applied.

Although all operations are done in 2D space the transformation matrix is a 3x3 matrix because homogeneous coordinates are used. This, however, also means that only six entries are actually used that are named like in the following graphic:

```a b 0
c d 0
e f 1
```

Here is a simple transformation matrix to translate all coordinates by 5 units horizontally and 10 units vertically:

```1  0 0
0  1 0
5 10 1```

Details and some examples can be found in the PDF reference.

See: PDF1.7 s8.3

### Attributes

a[R]

The value at the position (1,1) in the matrix.

b[R]

The value at the position (1,2) in the matrix.

c[R]

The value at the position (2,1) in the matrix.

d[R]

The value at the position (2,2) in the matrix.

e[R]

The value at the position (3,1) in the matrix.

f[R]

The value at the position (3,2) in the matrix.

### Public Class Methods

new(a = 1, b = 0, c = 0, d = 1, e = 0, f = 0)

Initializes the transformation matrix with the given values.

### Public Instance Methods

==(other)

Returns `true` if the other object is a transformation matrix with the same values.

evaluate(x, y)

Returns the untransformed coordinates of the given point.

premultiply(a, b, c, d, e, f)

Transforms this matrix by premultiplying it with the given one (ie. given*this) and returns it.

rotate(q)

Rotates this matrix by an angle of `q` degrees and returns it.

scale(sx, sy)

Scales this matrix by `sx` units horizontally and `y` units vertically and returns it.

This is equal to premultiply(sx, 0, 0, sy, 0, 0).

skew(a, b)

Skews this matrix by an angle of `a` degrees for the x axis and by an angle of `b` degrees for the y axis and returns it.

Translates this matrix by `x` units horizontally and `y` units vertically and returns it.