# # Two.Matrix

A class to store 3 x 3 transformation matrix information. In addition to storing data `Two.Matrix`

has suped up methods for commonplace mathematical operations.

### # Constructor

Argument | Description |
---|---|

a | The value for element at the first column and first row. |

b | The value for element at the second column and first row. |

c | The value for element at the third column and first row. |

d | The value for element at the first column and second row. |

e | The value for element at the second column and second row. |

f | The value for element at the third column and second row. |

g | The value for element at the first column and third row. |

h | The value for element at the second column and third row. |

i | The value for element at the third column and third row. |

## # Multiply

## Two.Matrix.Multiply

**Returns**: Two.Matrix

- If an optional
`C`

matrix isn't passed then a new one is created and returned.

Argument | Description |
---|---|

A | |

B | |

C | An optional matrix to apply the multiplication to. |

Multiply two matrices together and return the result.

## # manual

## Two.Matrix.manual

Determines whether Two.js automatically calculates the values for the matrix or if the developer intends to manage the matrix.

## # set

## Two.Matrix.set

Argument | Description |
---|---|

a | The value for element at the first column and first row. |

b | The value for element at the second column and first row. |

c | The value for element at the third column and first row. |

d | The value for element at the first column and second row. |

e | The value for element at the second column and second row. |

f | The value for element at the third column and second row. |

g | The value for element at the first column and third row. |

h | The value for element at the second column and third row. |

i | The value for element at the third column and third row. |

Set an array of values onto the matrix. Order described in Two.Matrix.

## # set

## Two.Matrix.set

Argument | Description |
---|---|

a | The array of elements to apply. |

Set an array of values onto the matrix. Order described in Two.Matrix.

## # multiply

## Two.Matrix.multiply

*Overloaded*

Argument | Description |
---|---|

a | The scalar to be multiplied. |

Multiply all components of the matrix against a single scalar value.

## # multiply

## Two.Matrix.multiply

*Overloaded*

Argument | Description |
---|---|

a | The x component to be multiplied. |

b | The y component to be multiplied. |

c | The z component to be multiplied. |

Multiply all components of a matrix against a 3 component vector.

## # multiply

## Two.Matrix.multiply

*Overloaded*

Argument | Description |
---|---|

a | The value at the first column and first row of the matrix to be multiplied. |

b | The value at the second column and first row of the matrix to be multiplied. |

c | The value at the third column and first row of the matrix to be multiplied. |

d | The value at the first column and second row of the matrix to be multiplied. |

e | The value at the second column and second row of the matrix to be multiplied. |

f | The value at the third column and second row of the matrix to be multiplied. |

g | The value at the first column and third row of the matrix to be multiplied. |

h | The value at the second column and third row of the matrix to be multiplied. |

i | The value at the third column and third row of the matrix to be multiplied. |

Multiply all components of a matrix against another matrix.

## # inverse

## Two.Matrix.inverse

Argument | Description |
---|---|

out | The optional matrix to apply the inversion to. |

Return an inverted version of the matrix. If no optional one is passed a new matrix is created and returned.

## # scale

## Two.Matrix.scale

Argument | Description |
---|---|

scale | The one dimensional scale to apply to the matrix. |

Uniformly scale the transformation matrix.

## # scale

## Two.Matrix.scale

Argument | Description |
---|---|

sx | The horizontal scale factor. |

sy | The vertical scale factor |

Scale the transformation matrix in two dimensions.

## # rotate

## Two.Matrix.rotate

Argument | Description |
---|---|

Number | The amount to rotate in Number. |

Rotate the matrix.

## # translate

## Two.Matrix.translate

Argument | Description |
---|---|

x | The horizontal translation value to apply. |

y | The vertical translation value to apply. |

Translate the matrix.

## # skewX

## Two.Matrix.skewX

Argument | Description |
---|---|

Number | The amount to skew in Number. |

Skew the matrix by an angle in the x axis direction.

## # skewY

## Two.Matrix.skewY

Argument | Description |
---|---|

Number | The amount to skew in Number. |

Skew the matrix by an angle in the y axis direction.

## # toString

## Two.Matrix.toString

**Returns**: String

- The transformation matrix as a 6 component string separated by spaces.

Argument | Description |
---|---|

fullMatrix | Return the full 9 elements of the matrix or just 6 for 2D transformations. |

Create a transform string. Used for the Two.js rendering APIs.

## # toTransformArray

## Two.Matrix.toTransformArray

Argument | Description |
---|---|

fullMatrix | Return the full 9 elements of the matrix or just 6 in the format for 2D transformations. |

output | An array empty or otherwise to apply the values to. |

Create a transform array. Used for the Two.js rendering APIs.

## # toArray

## Two.Matrix.toArray

Argument | Description |
---|---|

fullMatrix | Return the full 9 elements of the matrix or just 6 for 2D transformations. |

output | An array empty or otherwise to apply the values to. |

Create a transform array. Used for the Two.js rendering APIs.

## # toObject

## Two.Matrix.toObject

Create a JSON compatible object that represents information of the matrix.

← Two.Anchor Two.Shape →