# Class: Matrix3

## Table of contents

### Constructors

- constructor

### Accessors

- raw
- IDENTITY

### Methods

- inverse
- multiply
- rotate
- scale
- setArray
- toArray
- transformPoint
- translate
- createFromArray
- createFromTypedArray

## Constructors

### constructor

• **new Matrix3**(`raw?`, `offset?`)

#### Parameters

| Name | Type |
| :------ | :------ |
| `raw?` | `Float32Array` |
| `offset?` | `number` |

## Accessors

### raw

• `get` **raw**(): `Float32Array`

#### Returns

`Float32Array`

___

### IDENTITY

• `Static` `get` **IDENTITY**(): [`Matrix3`](Matrix3)

单位矩阵

**`readonly`**

**`static`**

**`memberof`** Matrix3

#### Returns

[`Matrix3`](Matrix3)

单位矩阵，每次返回都会创建新的对象

## Methods

### inverse

▸ **inverse**(`dst?`): [`Matrix3`](Matrix3)

求该矩阵的逆

**`memberof`** Matrix3

#### Parameters

| Name | Type |
| :------ | :------ |
| `dst?` | [`Matrix3`](Matrix3) |

#### Returns

[`Matrix3`](Matrix3)

计算结果

___

### multiply

▸ **multiply**(`m`, `dst?`): [`Matrix3`](Matrix3)

将该矩阵与另一个矩阵相乘

**`memberof`** Matrix3

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `m` | [`Matrix3`](Matrix3) | 右乘矩阵 |
| `dst?` | [`Matrix3`](Matrix3) | - |

#### Returns

[`Matrix3`](Matrix3)

计算结果

___

### rotate

▸ **rotate**(`radians`, `dst?`): [`Matrix3`](Matrix3)

将该矩阵进行旋转变换

**`memberof`** Matrix3

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `radians` | `number` | 旋转幅度，用弧度表示 |
| `dst?` | [`Matrix3`](Matrix3) | - |

#### Returns

[`Matrix3`](Matrix3)

计算结果

___

### scale

▸ **scale**(`sx`, `sy`, `dst?`): [`Matrix3`](Matrix3)

将该矩阵进行缩放变换

**`memberof`** Matrix3

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `sx` | `number` | x轴缩放 |
| `sy` | `number` | y轴缩放 |
| `dst?` | [`Matrix3`](Matrix3) | - |

#### Returns

[`Matrix3`](Matrix3)

计算结果

___

### setArray

▸ **setArray**(`value`, `offset?`): [`Matrix3`](Matrix3)

#### Parameters

| Name | Type |
| :------ | :------ |
| `value` | `ArrayLike` |
| `offset?` | `number` |

#### Returns

[`Matrix3`](Matrix3)

___

### toArray

▸ **toArray**(): `number`[]

返回矩阵数据

**`memberof`** Matrix3

#### Returns

`number`[]

矩阵数据，以JSArray返回

___

### transformPoint

▸ **transformPoint**(`v`, `dst?`): [`Vector2`](Vector2)

矩阵变换作用于点

**`memberof`** Matrix3

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `v` | [`Vector2`](Vector2) | 点 |
| `dst?` | [`Vector2`](Vector2) | - |

#### Returns

[`Vector2`](Vector2)

计算结果

___

### translate

▸ **translate**(`tx`, `ty`, `dst?`): [`Matrix3`](Matrix3)

将该矩阵进行位移变换

**`memberof`** Matrix3

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `tx` | `number` | x轴位移 |
| `ty` | `number` | y轴位移 |
| `dst?` | [`Matrix3`](Matrix3) | - |

#### Returns

[`Matrix3`](Matrix3)

计算结果

___

### createFromArray

▸ `Static` **createFromArray**(`array`): [`Matrix3`](Matrix3)

使用一个数组创建
此操作会拷贝一份数组

**`static`**

**`memberof`** Matrix3

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `array` | `number`[] | 数据源，长度必须为9，否则会抛出异常 |

#### Returns

[`Matrix3`](Matrix3)

创建出来的矩阵

___

### createFromTypedArray

▸ `Static` **createFromTypedArray**(`array`, `offset?`): [`Matrix3`](Matrix3)

使用某个已有的typedArray创建
此操作不会拷贝数据，而是在原来的内存区域上操作

**`static`**

**`memberof`** Matrix3

#### Parameters

| Name | Type | Default value | Description |
| :------ | :------ | :------ | :------ |
| `array` | `Float32Array` | `undefined` | 数据源 |
| `offset` | `number` | `0` | - |

#### Returns

[`Matrix3`](Matrix3)

创建出来的矩阵
