# Matrix Struct

> A transformation matrix in a PDF file is specified by six numbers.

- Product: Adobe PDF Library 21
- Language: Modern C++
- Version: 21.4.0
- HTML page: https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/struct/Matrix
- Version index: https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/llms.txt

```cpp
struct Matrix
```

**Namespace:** `datalogics_interface`

## Description

A transformation matrix in a PDF file is specified by six numbers.

The matrix is usually in the form of an array containing the six elements [a b c d h v].

A translation is specified as [ 1 0 0 1 tx ty], where tx and ty are the distance to translate from the origin of the coordinate system in the horizontal and vertical dimension, respectively.

A scaling is obtained by [sx 0 0 sy 0 0]. This scales the coordinates so that 1 unit in the horizontal and vertical dimension of the new coordinate system is the same size as sx and sy units, respectively, as in the previous coordinate system.

A rotation is produced by [ cos T sin T -sin T cos T 0 0 ], which has the effect of rotating the coordinate system axes by an angle T (degrees) counterclockwise.

This material indicates that the matrix specifying a transformation is premultiplied with the current transformation matrix, i.e.,

M' = Mt * M

The implementation of the Scale, Rotate, and Translate convenience functions of Matrix reflect the same order of operations, so that they are consistent with the PDF Reference manual. They are also consistent with the scale, rotate, and translate operators in PostScript, from which the coordinate system model in PDF is derived.

**Referenced by:** [`Container`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Container.md), [`Content`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Content.md), [`DrawParams`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/DrawParams.md), [`Element`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Element.md), [`Form`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Form.md), [`Group`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Group.md), [`Image`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Image.md), [`Matrix`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/struct/Matrix.md), [`Path`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Path.md), [`Text`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Text.md), [`TextRun`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/TextRun.md)

**Uses types:** [`Matrix`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/struct/Matrix.md)

## Constructors

### Matrix

```cpp
datalogics_interface::Matrix::Matrix()=default
```

*constructor*

### Matrix

```cpp
datalogics_interface::Matrix::Matrix(double a, double b, double c, double d, double h, double v)
```

*constructor*

**Parameters**

- `a` (`double`)
- `b` (`double`)
- `c` (`double`)
- `d` (`double`)
- `h` (`double`)
- `v` (`double`)

## Fields

### a

```cpp
double datalogics_interface::Matrix::a
```

### b

```cpp
double datalogics_interface::Matrix::b
```

### c

```cpp
double datalogics_interface::Matrix::c
```

### d

```cpp
double datalogics_interface::Matrix::d
```

### h

```cpp
double datalogics_interface::Matrix::h
```

### v

```cpp
double datalogics_interface::Matrix::v
```

## Methods

### concat

```cpp
Matrix datalogics_interface::Matrix::concat(const Matrix &other) const
```

**Parameters**

- `other` ([`const Matrix &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/struct/Matrix.md))

**Returns:** [`Matrix`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/struct/Matrix.md)

### invert

```cpp
Matrix datalogics_interface::Matrix::invert() const
```

**Returns:** [`Matrix`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/struct/Matrix.md)

### multiply

```cpp
static Matrix datalogics_interface::Matrix::multiply(const Matrix &m1, const Matrix &m2)
```

*static*

**Parameters**

- `m1` ([`const Matrix &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/struct/Matrix.md))
- `m2` ([`const Matrix &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/struct/Matrix.md))

**Returns:** [`Matrix`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/struct/Matrix.md)

### operator!=

```cpp
bool datalogics_interface::Matrix::operator!=(const Matrix &rhs) const
```

**Parameters**

- `rhs` ([`const Matrix &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/struct/Matrix.md))

**Returns:** `bool`

### operator==

```cpp
bool datalogics_interface::Matrix::operator==(const Matrix &rhs) const
```

**Parameters**

- `rhs` ([`const Matrix &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/struct/Matrix.md))

**Returns:** `bool`

### rotate

```cpp
Matrix datalogics_interface::Matrix::rotate(double degrees) const
```

**Parameters**

- `degrees` (`double`)

**Returns:** [`Matrix`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/struct/Matrix.md)

### scale

```cpp
Matrix datalogics_interface::Matrix::scale(double sx, double sy) const
```

**Parameters**

- `sx` (`double`)
- `sy` (`double`)

**Returns:** [`Matrix`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/struct/Matrix.md)

### to_string

```cpp
std::string datalogics_interface::Matrix::to_string() const
```

**Returns:** `std::string`

### translate

```cpp
Matrix datalogics_interface::Matrix::translate(double tx, double ty) const
```

**Parameters**

- `tx` (`double`)
- `ty` (`double`)

**Returns:** [`Matrix`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/struct/Matrix.md)
