Hide menu
Loading...
Searching...
No Matches
Matrix3d

Defines a square matrix of size three.

Extends

Constructors

Constructor

new Matrix3d(): Matrix3d

Creates an identity matrix.

Returns

Matrix3d

Overrides

Matrix.constructor

Constructor

new Matrix3d(elements): Matrix3d

Creates a matrix from elements in row-major order.

Parameters

elements

number[]

Matrix elements in row-major order.

Returns

Matrix3d

Overrides

Matrix.constructor

Constructor

new Matrix3d(e11, e12, e13, e21, e22, e23, e31, e32, e33): Matrix3d

Creates a matrix from individual element values.

Parameters

e11

number

Element [0][0].

e12

number

Element [0][1].

e13

number

Element [0][2].

e21

number

Element [1][0].

e22

number

Element [1][1].

e23

number

Element [1][2].

e31

number

Element [2][0].

e32

number

Element [2][1].

e33

number

Element [2][2].

Returns

Matrix3d

Overrides

Matrix.constructor

Properties

dimension

readonly dimension: number

Matrix dimension.

Inherited from

Matrix.dimension

Accessors

elements

Get Signature

get elements(): number[]

Returns the matrix elements in row-major order.

Returns

number[]

Set Signature

set elements(elements): void

Sets the matrix elements from an array in row-major order.

Throws a RangeError if elements.length is not equal to dimension * dimension.

Parameters

elements

number[]

Matrix elements in row-major order.

Returns

void

Inherited from

Matrix.elements

Methods

add()

add(other): this

Adds the elements of other to this matrix.

Throws a RangeError if other.dimension is not equal to this.dimension.

Parameters

other

Matrix

Other matrix.

Returns

this

Inherited from

Matrix.add


added()

added(other): Matrix

Returns a new matrix resulting from adding other to this matrix.

Parameters

other

Matrix

Other matrix.

Returns

Matrix

Inherited from

Matrix.added


clone()

clone(): Matrix3d

Creates a new matrix with the same elements as this matrix.

Returns

Matrix3d

Overrides

Matrix.clone


column()

column(column): number[]

Returns the elements of column.

Throws a RangeError if column is outside the valid range.

Parameters

column

number

Column index.

Returns

number[]

Inherited from

Matrix.column


copy()

copy(other): this

Copies the elements of other to this matrix.

Throws a RangeError if other.dimension is not equal to this.dimension.

Parameters

other

Matrix

Matrix to copy.

Returns

this

Inherited from

Matrix.copy


determinant()

determinant(): number

Returns the determinant of this matrix.

Returns

number

Overrides

Matrix.determinant


diagonal()

diagonal(): number[]

Returns the diagonal elements.

Returns

number[]

Inherited from

Matrix.diagonal


divide()

divide(scalar): this

Divides the elements of this matrix by scalar.

Parameters

scalar

number

Scalar.

Returns

this

Inherited from

Matrix.divide


divided()

divided(scalar): Matrix

Returns a new matrix resulting from dividing this matrix by scalar.

Parameters

scalar

number

Scalar.

Returns

Matrix

Inherited from

Matrix.divided


fill()

fill(value): this

Fills the matrix with value.

Parameters

value

number

Value to fill matrix.

Returns

this

Inherited from

Matrix.fill


get()

get(index): number

Returns the element at index in the row-major array representation.

Throws a RangeError if index is outside the valid range.

Parameters

index

number

Element index in row-major order.

Returns

number

Inherited from

Matrix.get


identity()

static identity(): Matrix3d

Returns an identity matrix.

Returns

Matrix3d


invert()

invert(): this

Inverts this matrix.

Throws an Error if the matrix is singular.

Returns

this

Overrides

Matrix.invert


inverted()

inverted(): Matrix

Returns a new matrix resulting from inverting this matrix.

Returns

Matrix

Inherited from

Matrix.inverted


isEqual()

isEqual(other, tolerance?): boolean

Returns whether other has the same dimension as this matrix and all corresponding elements are equal within tolerance.

Parameters

other

Matrix

Other matrix.

tolerance?

number = Matrix.coincidenceTolerance

Comparison tolerance. The default is 1e-7.

Returns

boolean

Inherited from

Matrix.isEqual


isIdentity()

isIdentity(): boolean

Returns whether this matrix is the identity matrix.

Returns

boolean

Inherited from

Matrix.isIdentity


isSingular()

isSingular(): boolean

Returns whether the determinant of this matrix is close to 0.

Returns

boolean

Inherited from

Matrix.isSingular


multiplied()

Call Signature

multiplied(other): Matrix

Returns a new matrix resulting from multiplying this matrix by other.

Parameters

other

Matrix

Other matrix.

Returns

Matrix

Inherited from

Matrix.multiplied

Call Signature

multiplied(scalar): Matrix

Returns a new matrix resulting from multiplying this matrix by scalar.

Parameters

scalar

number

Scalar.

Returns

Matrix

Inherited from

Matrix.multiplied


multiply()

Call Signature

multiply(other): this

Multiplies this matrix by other.

Throws a RangeError if this.dimension and other.dimension are not equal.

Parameters

other

Matrix

Other matrix.

Returns

this

Inherited from

Matrix.multiply

Call Signature

multiply(scalar): this

Multiplies the elements of this matrix by scalar.

Parameters

scalar

number

Scalar.

Returns

this

Inherited from

Matrix.multiply


power()

power(num): this

Raises this matrix to the power num.

Parameters

num

number

Power value.

Returns

this

Inherited from

Matrix.power


powered()

powered(num): Matrix

Returns a new matrix resulting from raising this matrix to the power num.

Parameters

num

number

Power value.

Returns

Matrix

Inherited from

Matrix.powered


preMultiplied()

preMultiplied(other): Matrix3d

Returns a new matrix resulting from pre-multiplying this matrix by other.

Parameters

other

Matrix3d

Other matrix.

Returns

Matrix3d


preMultiply()

preMultiply(other): this

Pre-multiplies this matrix by other.

Parameters

other

Matrix3d

Other matrix.

Returns

this


reset()

reset(): this

Resets this matrix to the identity matrix.

Returns

this

Inherited from

Matrix.reset


row()

row(row): number[]

Returns the elements of row.

Throws a RangeError if row is outside the valid range.

Parameters

row

number

Row index.

Returns

number[]

Inherited from

Matrix.row


set()

set(index, value): this

Sets the element at index in the row-major array representation.

Throws a RangeError if index is outside the valid range.

Parameters

index

number

Element index in row-major order.

value

number

Element value.

Returns

this

Inherited from

Matrix.set


setColumn()

Call Signature

setColumn(column, elements): this

Sets the elements of column.

Throws a RangeError if column is outside the range [0, 2] or elements.length is not 3.

Parameters

column

number

Column index.

elements

number[]

Column elements.

Returns

this

Overrides

Matrix.setColumn

Call Signature

setColumn(column, e1, e2, e3): this

Sets the elements of column.

Throws a RangeError if column is outside the range [0, 2].

Parameters

column

number

Column index.

e1

number

Column first element.

e2

number

Column second element.

e3

number

Column third element.

Returns

this

Overrides

Matrix.setColumn


setCross()

setCross(reference): this

Sets this matrix to the skew-symmetric cross-product matrix of reference.

Throws a RangeError if reference.length is not 3.

Parameters

reference

number[]

Reference array.

Returns

this


setDiagonal()

Call Signature

setDiagonal(elements): this

Sets the diagonal elements.

Throws a RangeError if elements.length is not 3.

Parameters

elements

number[]

Diagonal elements.

Returns

this

Overrides

Matrix.setDiagonal

Call Signature

setDiagonal(e1, e2, e3): this

Sets the diagonal elements.

Parameters

e1

number

Diagonal first element.

e2

number

Diagonal second element.

e3

number

Diagonal third element.

Returns

this

Overrides

Matrix.setDiagonal


setDot()

setDot(reference): this

Sets this matrix to the outer-product matrix of reference.

Throws a RangeError if reference.length is not 3.

Parameters

reference

number[]

Reference array.

Returns

this


setElements()

Call Signature

setElements(elements): this

Sets matrix elements from an array in row-major order.

Throws a RangeError if elements.length is not 9.

Parameters

elements

number[]

Matrix elements in row-major order.

Returns

this

Overrides

Matrix.setElements

Call Signature

setElements(e11, e12, e13, e21, e22, e23, e31, e32, e33): this

Sets matrix elements in row-major order.

Parameters

e11

number

Element [0][0].

e12

number

Element [0][1].

e13

number

Element [0][2].

e21

number

Element [1][0].

e22

number

Element [1][1].

e23

number

Element [1][2].

e31

number

Element [2][0].

e32

number

Element [2][1].

e33

number

Element [2][2].

Returns

this

Overrides

Matrix.setElements


setRotation()

setRotation(axis, angle): this

Modifies the matrix so that it represents a rotation around axis by angle.

Parameters

axis

Direction

Rotation axis.

angle

number

Rotation angle.

Returns

this


setRow()

Call Signature

setRow(row, elements): this

Sets the elements of row.

Throws a RangeError if row is outside the range [0, 2] or elements.length is not 3.

Parameters

row

number

Row index.

elements

number[]

Row elements.

Returns

this

Overrides

Matrix.setRow

Call Signature

setRow(row, e1, e2, e3): this

Sets the elements of row.

Throws a RangeError if row is outside the range [0, 2].

Parameters

row

number

Row index.

e1

number

Row first element.

e2

number

Row second element.

e3

number

Row third element.

Returns

this

Overrides

Matrix.setRow


setScale()

setScale(scale): this

Resets this matrix to a diagonal scale matrix with scale on the diagonal.

Parameters

scale

number

Scale value.

Returns

this

Inherited from

Matrix.setScale


setValue()

setValue(row, column, value): this

Sets the value at [row][column].

Throws a RangeError if row or column is outside the valid range.

Parameters

row

number

Row index.

column

number

Column index.

value

number

New value.

Returns

this

Inherited from

Matrix.setValue


subtract()

subtract(other): this

Subtracts the elements of other from this matrix.

Throws a RangeError if other.dimension is not equal to this.dimension.

Parameters

other

Matrix

Other matrix.

Returns

this

Inherited from

Matrix.subtract


subtracted()

subtracted(other): Matrix

Returns a new matrix resulting from subtracting other from this matrix.

Parameters

other

Matrix

Other matrix.

Returns

Matrix

Inherited from

Matrix.subtracted


toString()

toString(precision?): string

Returns a string representation of this matrix with the provided precision.

Parameters

precision?

number = 3

Precision.

Returns

string

Inherited from

Matrix.toString


transpose()

transpose(): this

Transposes this matrix.

Returns

this

Inherited from

Matrix.transpose


transposed()

transposed(): Matrix

Returns a new matrix resulting from transposing this matrix.

Returns

Matrix

Inherited from

Matrix.transposed


value()

value(row, column): number

Returns the value at [row][column].

Throws a RangeError if row or column is outside the valid range.

Parameters

row

number

Row index.

column

number

Column index.

Returns

number

Inherited from

Matrix.value