Matrix2 class Null safety

2D Matrix. Values are stored in column major order.

Constructors

Matrix2(double arg0, double arg1, double arg2, double arg3)
New matrix with specified values.
factory
Matrix2.columns(Vector2 arg0, Vector2 arg1)
Matrix with values from column arguments.
factory
Matrix2.copy(Matrix2 other)
Copies values from other.
factory
Matrix2.fromList(List<double> values)
New matrix from values.
factory
Matrix2.identity()
Identity matrix.
factory
Matrix2.outer(Vector2 u, Vector2 v)
Outer product of u and v.
factory
Matrix2.rotation(double radians)
Rotation of radians.
factory
Matrix2.zero()
Zero matrix.

Properties

dimension int
Dimension of the matrix.
read-only
hashCode int
The hash code for this object.
read-onlyoverride
row0 Vector2
Returns row 0
read / write
row1 Vector2
Returns row 1
read / write
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited
storage Float32List
The components of the matrix.
read-only

Methods

absolute() Matrix2
Returns the component wise absolute value of this.
absoluteError(Matrix2 correct) double
Returns absolute error between this and correct
add(Matrix2 o) → void
Add o to this.
clone() Matrix2
Create a copy of this.
copyFromArray(List<double> array, [int offset = 0]) → void
Copies elements from array into this starting at offset.
copyInto(Matrix2 arg) Matrix2
Copy this into arg.
copyIntoArray(List<num> array, [int offset = 0]) → void
Copies this into array starting at offset.
copyInverse(Matrix2 arg) double
Set this matrix to be the inverse of arg
determinant() double
Returns the determinant of this matrix.
dotColumn(int j, Vector2 v) double
Returns the dot product of column j and v.
dotRow(int i, Vector2 v) double
Returns the dot product of row i and v.
entry(int row, int col) double
Value at row, col.
getColumn(int column) Vector2
Gets the column of the matrix
getRow(int row) Vector2
Gets the row of the matrix
index(int row, int col) int
Return index in storage for row, col value.
infinityNorm() double
Returns infinity norm of the matrix. Used for numerical analysis.
invert() double
Invert the matrix. Returns the determinant.
multiplied(Matrix2 arg) Matrix2
Multiply this with arg and return the product.
multiply(Matrix2 arg) → void
Multiply this with arg and store it in this.
multiplyTranspose(Matrix2 arg) → void
Multiply this with a transposed arg.
negate() → void
Negate this.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
relativeError(Matrix2 correct) double
Returns relative error between this and correct
scale(double scale) → void
Scale this by scale.
scaleAdjoint(double scale) → void
Converts into Adjugate matrix and scales by scale
scaled(double scale) Matrix2
Create a copy of this scaled by scale.
setColumn(int column, Vector2 arg) → void
Assigns the column of the matrix arg
setColumns(Vector2 arg0, Vector2 arg1) → void
Sets the entire matrix to the column values.
setDiagonal(Vector2 arg) → void
Sets the diagonal of the matrix to be arg.
setEntry(int row, int col, double v) → void
Set value at row, col to be v.
setFrom(Matrix2 arg) → void
Sets the entire matrix to the matrix in arg.
setIdentity() → void
Makes this into the identity matrix.
setOuter(Vector2 u, Vector2 v) → void
Set this to the outer product of u and v.
setRotation(double radians) → void
Turns the matrix into a rotation of radians
setRow(int row, Vector2 arg) → void
Sets row of the matrix to values in arg
setValues(double arg0, double arg1, double arg2, double arg3) → void
Sets the matrix with specified values.
setZero() → void
Zeros this.
splatDiagonal(double arg) → void
Sets the diagonal to arg.
sub(Matrix2 o) → void
Subtract o from this.
toString() String
Returns a printable string
override
trace() double
Trace of the matrix.
transform(Vector2 arg) Vector2
Transform arg of type Vector2 using the transformation defined by this.
transformed(Vector2 arg, [Vector2? out]) Vector2
Transform a copy of arg of type Vector2 using the transformation defined by this. If a out parameter is supplied, the copy is stored in out.
transpose() → void
transposed() Matrix2
Returns the tranpose of this.
transposeMultiply(Matrix2 arg) → void
Multiply a transposed this with arg.

Operators

operator *(dynamic arg) → dynamic
Returns a new vector or matrix by multiplying this with arg.
operator +(Matrix2 arg) Matrix2
Returns new matrix after component wise this + arg
operator -(Matrix2 arg) Matrix2
Returns new matrix after component wise this - arg
operator ==(Object? other) bool
Check if two matrices are the same.
override
operator [](int i) double
Access the element of the matrix at the index i.
operator []=(int i, double v) → void
Set the element of the matrix at the index i.
operator unary-() Matrix2
Returns new matrix -this

Static Methods

solve(Matrix2 A, Vector2 x, Vector2 b) → void
Solve A * x = b.