new Matrix2d():
Matrix2d
new Matrix2d(
elements):Matrix2d
number[]
Matrix.constructor
new Matrix2d(
e11,e12,e21,e22):Matrix2d
number
number
number
number
Matrix.constructor
readonlydimension:number
Matrix dimension.
get elements():
number[]
Returns matrix elements array in row-major order.
number[]
set elements(
elements):void
Sets matrix elements. Throw exception if elements length not equal to Matrix#dimension x Matrix#dimension.
number[]
Elements array in row-major order.
void
add(
other):this
Adds elements of other matrix to this matrix. Do nothing if other matrix Matrix#dimension not equal to this matrix Matrix#dimension.
Other matrix.
this
added(
other):Matrix
Returns new Matrix object received by performing a add() operation to this object.
Other matrix.
clone():
Matrix2d
Creates new Matrix2d object same as this.
column(
column):number[]
Returns array of elements from column. Throws exception if column greater or equal than Matrix#dimension.
number
Column index.
number[]
copy(
other):this
Copies values from another matrix.
Copied object.
this
determinant():
number
Returns this matrix determinant.
number
diagonal():
number[]
Returns array of diagonal elements.
number[]
divide(
scalar):this
Divides elements of this matrix by scalar.
number
Scalar.
this
divided(
scalar):Matrix
Returns new Matrix object received by performing a divide() operation to this object.
number
Scalar.
fill(
value):this
Fill matrix with defined value.
number
Value to fill matrix.
this
get(
index):number
Returns value of the matrix element placed in row-major order array at index position. Throws exception if index greater or equal than Matrix#dimension x Matrix#dimension.
number
Element index in row-major order array.
number
invert():
this
Inverts this matrix.
this
inverted():
Matrix
Returns new Matrix object received by performing a invert() operation to this object.
isEqual(
other,tolerance):boolean
Returns true if this matrix have same Matrix#dimension as other matrix and all the elements are equal within provided tolerance (1e-7 by default).
number = Matrix.coincidenceTolerance
boolean
isIdentity():
boolean
Returns true if matrix is identity.
boolean
isSingular():
boolean
Returns true if this matrix determinant tends to 0.
boolean
multiplied(
other):Matrix
Returns new Matrix object received by performing a multiply() operation to this object.
Other matrix.
multiplied(
scalar):Matrix
Returns new Matrix object received by performing a multiply() operation to this object.
number
Scalar.
multiply(
other):this
Multiplies this matrix by other matrix. Throws exception if dimensions of this and other matrixes are not equal.
Other matrix.
this
multiply(
scalar):this
Multiplies elements of this matrix by scalar.
number
Scalar.
this
power(
num):this
Powers this matrix.
number
Power value.
this
powered(
num):Matrix
Returns new Matrix object received by performing a power() operation to this object.
number
Power value.
preMultiplied(
other):Matrix2d
Returns new Matrix2d object received by performing a preMultiply()
Other matrix.
preMultiply(
other):this
Pre multiplies this matrix by other matrix.
Other matrix.
this
reset():
this
Makes this matrix as identity matrix.
this
row(
row):number[]
Returns array of elements from row. Throws exception if row greater or equal than Matrix#dimension.
number
Row index.
number[]
set(
index,value):this
Sets value of the matrix element placed in row-major order array at index position. Throws exception if index greater or equal than Matrix#dimension x Matrix#dimension.
number
Element index in row-major order array.
number
Element value.
this
setColumn(
column,elements):this
Sets elements in column. Throws exception if column greater or equal than Matrix#dimension (2) or elements length not equal to Matrix#dimension (2).
number
Column index.
number[]
Column elements.
this
setColumn(
column,e1,e2):this
Sets elements in column. Throws exception if column greater or equal than Matrix#dimension (2).
number
Column index.
number
Column first element.
number
Column second element.
this
Matrix.setColumn
setDiagonal(
elements):this
Sets diagonal elements. Throws exception if elements length not equal to Matrix#dimension (2).
number[]
Diagonal elements.
this
setDiagonal(
e1,e2):this
Sets diagonal elements.
number
Diagonal first element.
number
Diagonal second element.
this
Matrix.setDiagonal
setElements(
elements):this
Sets matrix elements. Throw exception if elements length not equal to 4 (2x2).
number[]
Elements array in row-major order.
this
setElements(
e11,e12,e21,e22):this
Sets matrix elements in row-major order.
number
Element [0][0].
number
Element [0][1].
number
Element [1][0].
number
Element [1][1].
this
Matrix.setElements
setRotation(
angle):this
Sets this matrix elements by rotating on angle.
number
Rotation angle.
this
setRow(
row,elements):this
Sets elements in row. Throws exception if row greater or equal than Matrix#dimension (2) or elements length not equal to Matrix#dimension (2).
number
Row index.
number[]
Row elements.
this
setRow(
row,e1,e2):this
Sets elements in row. Throws exception if row greater or equal than Matrix#dimension (2).
number
Row index.
number
Row first element.
number
Row second element.
this
Matrix.setRow
setScale(
scale):this
Makes this matrix as identity matrix and fill diagonal with scale values.
number
Scale.
this
setValue(
row,column,value):this
Sets value from [row][column] of the matrix. Throws exception if row and / or column greater or equal than Matrix#dimension.
number
Row index.
number
Column index.
number
New value.
this
subtract(
other):this
Subtracts elements of other matrix from this matrix. Do nothing if other matrix Matrix#dimension not equal to this matrix Matrix#dimension.
Other matrix.
this
subtracted(
other):Matrix
Returns new Matrix object received by performing a subtract() operation to this object.
Other matrix.
toString(
precision):string
Returns string representation of this matrix with provided precision (3 by default).
number = 3
Precision.
string
transpose():
this
Transposes this matrix.
this
transposed():
Matrix
Returns new Matrix object received by performing a transpose() operation to this object.
value(
row,column):number
Returns value from [row][column] of the matrix. Throws exception if row and / or column greater or equal than Matrix#dimension.
number
Row index.
number
Column index.
number
staticidentity():Matrix2d
Returns identity matrix.