Home Reference Source
import {Matrix3} from 'math-ds'
public class | source

Matrix3

A 3x3 matrix.

Constructor Summary

Public Constructor
public

Constructs a new matrix.

Member Summary

Public Members
public

The matrix elements.

Method Summary

Public Methods
public

Clones this matrix.

public

copy(matrix: Matrix3): Matrix3

Copies the values of a given matrix.

public

Calculates the determinant of this matrix.

public

Checks if this matrix equals the given one.

public

fromArray(array: Number[], offset: Number): Matrix3

Copies the values of a given array.

public

Inverts the given matrix and stores the result in this matrix.

public

Sets this matrix to the identity matrix.

public

Multiplies this matrix with a given one.

public

Sets this matrix to the product of the given matrices.

public

Multiplies this matrix with a given scalar.

public

Multiplies a given matrix with this one.

public

rotate(theta: Number): Matrix3

Rotates this matrix.

public

scale(sx: Number, sy: Number): Matrix3

Scales this matrix.

public

set(m00: Number, m01: Number, m02: Number, m10: Number, m11: Number, m12: Number, m20: Number, m21: Number, m22: Number): Matrix3

Sets the values of this matrix.

public

toArray(array: Number[], offset: Number): Number[]

Stores this matrix in an array.

public

Translates this matrix.

public

Transposes this matrix.

Public Constructors

public constructor() source

Constructs a new matrix.

Public Members

public elements: Float32Array source

The matrix elements.

Public Methods

public clone(): Matrix3 source

Clones this matrix.

Return:

Matrix3

A clone of this matrix.

public copy(matrix: Matrix3): Matrix3 source

Copies the values of a given matrix.

Params:

NameTypeAttributeDescription
matrix Matrix3

A matrix.

Return:

Matrix3

This matrix.

public determinant(): Number source

Calculates the determinant of this matrix.

Return:

Number

The determinant.

public equals(m: Matrix3): Boolean source

Checks if this matrix equals the given one.

Params:

NameTypeAttributeDescription
m Matrix3

A matrix.

Return:

Boolean

Whether the matrix are equal.

public fromArray(array: Number[], offset: Number): Matrix3 source

Copies the values of a given array.

Params:

NameTypeAttributeDescription
array Number[]

An array.

offset Number
  • optional
  • default: 0

An offset into the array.

Return:

Matrix3

This matrix.

public getInverse(matrix: Matrix3): Matrix3 source

Inverts the given matrix and stores the result in this matrix.

Params:

NameTypeAttributeDescription
matrix Matrix3

The matrix that should be inverted.

Return:

Matrix3

This matrix.

public identity(): Matrix3 source

Sets this matrix to the identity matrix.

Return:

Matrix3

This matrix.

public multiply(m: Matrix3): Matrix3 source

Multiplies this matrix with a given one.

Params:

NameTypeAttributeDescription
m Matrix3

A matrix.

Return:

Matrix3

This matrix.

public multiplyMatrices(a: Matrix3, b: Matrix3): Matrix3 source

Sets this matrix to the product of the given matrices.

Params:

NameTypeAttributeDescription
a Matrix3

A matrix.

b Matrix3

A matrix.

Return:

Matrix3

This matrix.

public multiplyScalar(s: Number): Matrix3 source

Multiplies this matrix with a given scalar.

Params:

NameTypeAttributeDescription
s Number

A scalar.

Return:

Matrix3

This matrix.

public premultiply(m: Matrix3): Matrix3 source

Multiplies a given matrix with this one.

Params:

NameTypeAttributeDescription
m Matrix3

A matrix.

Return:

Matrix3

This matrix.

public rotate(theta: Number): Matrix3 source

Rotates this matrix.

Params:

NameTypeAttributeDescription
theta Number

The rotation.

Return:

Matrix3

This matrix.

public scale(sx: Number, sy: Number): Matrix3 source

Scales this matrix.

Params:

NameTypeAttributeDescription
sx Number

The X scale.

sy Number

The Y scale.

Return:

Matrix3

This matrix.

public set(m00: Number, m01: Number, m02: Number, m10: Number, m11: Number, m12: Number, m20: Number, m21: Number, m22: Number): Matrix3 source

Sets the values of this matrix.

Params:

NameTypeAttributeDescription
m00 Number

The value of the first row, first column.

m01 Number

The value of the first row, second column.

m02 Number

The value of the first row, third column.

m10 Number

The value of the second row, first column.

m11 Number

The value of the second row, second column.

m12 Number

The value of the second row, third column.

m20 Number

The value of the third row, first column.

m21 Number

The value of the third row, second column.

m22 Number

The value of the third row, third column.

Return:

Matrix3

This matrix.

public toArray(array: Number[], offset: Number): Number[] source

Stores this matrix in an array.

Params:

NameTypeAttributeDescription
array Number[]
  • optional

A target array.

offset Number
  • optional
  • default: 0

An offset into the array.

Return:

Number[]

The array.

public translate(tx: Number, ty: Number): Matrix3 source

Translates this matrix.

Params:

NameTypeAttributeDescription
tx Number

The X offset.

ty Number

The Y offset.

Return:

Matrix3

This matrix.

public transpose(): Matrix3 source

Transposes this matrix.

Return:

Matrix3

This matrix.