Defines a square matrix of size three.
new Matrix3d():
Matrix3d
Creates an identity matrix.
Matrix3d
new Matrix3d(
elements):Matrix3d
Creates a matrix from elements in row-major order.
number[]
Matrix elements in row-major order.
Matrix3d
Matrix.constructor
new Matrix3d(
e11,e12,e13,e21,e22,e23,e31,e32,e33):Matrix3d
Creates a matrix from individual element values.
number
Element [0][0].
number
Element [0][1].
number
Element [0][2].
number
Element [1][0].
number
Element [1][1].
number
Element [1][2].
number
Element [2][0].
number
Element [2][1].
number
Element [2][2].
Matrix3d
Matrix.constructor
readonlydimension:number
Matrix dimension.
get elements():
number[]
Returns the matrix elements in row-major order.
number[]
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.
number[]
Matrix elements in row-major order.
void
add(
other):this
Adds the elements of other to this matrix.
Throws a RangeError if other.dimension is not equal to this.dimension.
Other matrix.
this
added(
other):Matrix
Returns a new matrix resulting from adding other to this matrix.
Other matrix.
clone():
Matrix3d
Creates a new matrix with the same elements as this matrix.
Matrix3d
column(
column):number[]
Returns the elements of column.
Throws a RangeError if column is outside the valid range.
number
Column index.
number[]
copy(
other):this
Copies the elements of other to this matrix.
Throws a RangeError if other.dimension is not equal to this.dimension.
Matrix to copy.
this
determinant():
number
Returns the determinant of this matrix.
number
diagonal():
number[]
Returns the diagonal elements.
number[]
divide(
scalar):this
Divides the elements of this matrix by scalar.
number
Scalar.
this
divided(
scalar):Matrix
Returns a new matrix resulting from dividing this matrix by scalar.
number
Scalar.
fill(
value):this
Fills the matrix with value.
number
Value to fill matrix.
this
get(
index):number
Returns the element at index in the row-major array representation.
Throws a RangeError if index is outside the valid range.
number
Element index in row-major order.
number
staticidentity():Matrix3d
Returns an identity matrix.
Matrix3d
invert():
this
Inverts this matrix.
Throws an Error if the matrix is singular.
this
inverted():
Matrix
Returns a new matrix resulting from inverting this matrix.
isEqual(
other,tolerance?):boolean
Returns whether other has the same dimension as this matrix and all corresponding elements are equal within tolerance.
Other matrix.
number = Matrix.coincidenceTolerance
Comparison tolerance. The default is 1e-7.
boolean
isIdentity():
boolean
Returns whether this matrix is the identity matrix.
boolean
isSingular():
boolean
Returns whether the determinant of this matrix is close to 0.
boolean
multiplied(
other):Matrix
Returns a new matrix resulting from multiplying this matrix by other.
Other matrix.
multiplied(
scalar):Matrix
Returns a new matrix resulting from multiplying this matrix by scalar.
number
Scalar.
multiply(
other):this
Multiplies this matrix by other.
Throws a RangeError if this.dimension and other.dimension are not equal.
Other matrix.
this
multiply(
scalar):this
Multiplies the elements of this matrix by scalar.
number
Scalar.
this
power(
num):this
Raises this matrix to the power num.
number
Power value.
this
powered(
num):Matrix
Returns a new matrix resulting from raising this matrix to the power num.
number
Power value.
preMultiplied(
other):Matrix3d
Returns a new matrix resulting from pre-multiplying this matrix by other.
Matrix3d
Other matrix.
Matrix3d
preMultiply(
other):this
Pre-multiplies this matrix by other.
Matrix3d
Other matrix.
this
reset():
this
Resets this matrix to the identity matrix.
this
row(
row):number[]
Returns the elements of row.
Throws a RangeError if row is outside the valid range.
number
Row index.
number[]
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.
number
Element index in row-major order.
number
Element value.
this
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.
number
Column index.
number[]
Column elements.
this
setColumn(
column,e1,e2,e3):this
Sets the elements of column.
Throws a RangeError if column is outside the range [0, 2].
number
Column index.
number
Column first element.
number
Column second element.
number
Column third element.
this
Matrix.setColumn
setCross(
reference):this
Sets this matrix to the skew-symmetric cross-product matrix of reference.
Throws a RangeError if reference.length is not 3.
number[]
Reference array.
this
setDiagonal(
elements):this
Sets the diagonal elements.
Throws a RangeError if elements.length is not 3.
number[]
Diagonal elements.
this
setDiagonal(
e1,e2,e3):this
Sets the diagonal elements.
number
Diagonal first element.
number
Diagonal second element.
number
Diagonal third element.
this
Matrix.setDiagonal
setDot(
reference):this
Sets this matrix to the outer-product matrix of reference.
Throws a RangeError if reference.length is not 3.
number[]
Reference array.
this
setElements(
elements):this
Sets matrix elements from an array in row-major order.
Throws a RangeError if elements.length is not 9.
number[]
Matrix elements in row-major order.
this
setElements(
e11,e12,e13,e21,e22,e23,e31,e32,e33):this
Sets matrix elements in row-major order.
number
Element [0][0].
number
Element [0][1].
number
Element [0][2].
number
Element [1][0].
number
Element [1][1].
number
Element [1][2].
number
Element [2][0].
number
Element [2][1].
number
Element [2][2].
this
Matrix.setElements
setRotation(
axis,angle):this
Modifies the matrix so that it represents a rotation around axis by angle.
Rotation axis.
number
Rotation angle.
this
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.
number
Row index.
number[]
Row elements.
this
setRow(
row,e1,e2,e3):this
Sets the elements of row.
Throws a RangeError if row is outside the range [0, 2].
number
Row index.
number
Row first element.
number
Row second element.
number
Row third element.
this
Matrix.setRow
setScale(
scale):this
Resets this matrix to a diagonal scale matrix with scale on the diagonal.
number
Scale value.
this
setValue(
row,column,value):this
Sets the value at [row][column].
Throws a RangeError if row or column is outside the valid range.
number
Row index.
number
Column index.
number
New value.
this
subtract(
other):this
Subtracts the elements of other from this matrix.
Throws a RangeError if other.dimension is not equal to this.dimension.
Other matrix.
this
subtracted(
other):Matrix
Returns a new matrix resulting from subtracting other from this matrix.
Other matrix.
toString(
precision?):string
Returns a string representation of this matrix with the provided precision.
number = 3
Precision.
string
transpose():
this
Transposes this matrix.
this
transposed():
Matrix
Returns a new matrix resulting from transposing this matrix.
value(
row,column):number
Returns the value at [row][column].
Throws a RangeError if row or column is outside the valid range.
number
Row index.
number
Column index.
number